Skip to content

aliak00/dcli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

D-cli

Latest version Build Status codecov license

Dcli is a library that is intened to help with building command line tools in D.

Full API docs available here

Modules

ProgramOptions (docs)

Handles program options which are arguments passed with a leading - or -- and followed by a value

Features:

  • Input validation
  • Customize seperators for associative array args
  • Supports environment variables
  • Supports default values
  • Supports custom types that have a constructor that is called with a string

ProgramCommands (docs)

Provides a command handling and definitino framework. Allos you define a set of commands that can be accepted on the command line, and also invokes any given handlers for activated commands. Also integrated with ProgramOptions.

E.g.

// install.d
void commandHandler(T)(T commands) {
    writeln(commands.install); // prints true
}
// main.d
static import install, build;
void main(string[] args) {
    auto commands = ProgramCommands!(
        Command!"build".handler!(build.commandHandler)
        Command!"install".handler!(install.commandHandler)
    )();
    commands.parse(args);
    commands.executeHandlers();
}
// Run it
$ ./program install
$ >> true

About

CLI utilities for D programming language

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages