dcli 0.0.2
A library to help with building CLIs in D
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
This package provides sub packages which can be used individually:
dcli:program_options - Specify and parse command line options
dcli:program_commands - Specify and parse command line commands
D-cli
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
- Registered by ali akhtarzada
- 0.0.2 released 6 years ago
- aliak00/dcli
- MIT
- Copyright © 2018, Ali Akhtarzada
- Authors:
- Sub packages:
- dcli:program_options, dcli:program_commands
- Dependencies:
- dcli:program_options, dcli:program_commands
- Versions:
-
0.0.2 2018-Nov-04 0.0.1 2018-Nov-03 ~master 2018-Nov-05 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
18 downloads total
-
- Score:
- 1.0
- Short URL:
- dcli.dub.pm