Releases: malyjacob/d-cmdline
Releases · malyjacob/d-cmdline
v1.4.2
v1.4.1
v1.4.0
v1.3.4
v1.3.3
enable a break-through new way to build a command line program intuitively like this sample code or the following code:
module examples.strutil;
import std.stdio;
import std.string;
import cmdline;
struct StrutilResult {
mixin DESC!("CLI to some string utilities");
mixin VERSION!("0.0.1");
JoinResult* joinSub;
SplitResult* splitSub;
}
struct SplitResult {
mixin DESC!("Split a string into substrings and display as an array.");
ArgVal!string str;
mixin DESC!(str, "string to split");
OptVal!(string, "-s <char>") separator;
mixin DESC!(separator, "separator character");
mixin DEFAULT!(separator, ",");
void action() {
writeln(split(str.get, separator.get));
}
}
struct JoinResult {
mixin DESC!("Join the command-arguments into a single string.");
ArgVal!(string[]) strs;
mixin DESC!(strs, "one or more string");
OptVal!(string, "-s <char>") separator;
mixin DESC!(separator, "separator character");
mixin DEFAULT!(separator, ",");
void action() {
writeln(strs.get.join(separator.get));
}
}
void main(in string[] argv) {
argv.run!StrutilResult;
}
the details you can see are in sub-module cmdline.ext