Catch flag parse error
This commit is contained in:
parent
49768a38a7
commit
36c8b4d2d7
16
source/app.d
16
source/app.d
@ -19,9 +19,17 @@ Opts defaultOpts() {
|
||||
return opts;
|
||||
}
|
||||
|
||||
void printHelp(GetoptResult args) {
|
||||
defaultGetoptPrinter("prim prompt:\n", args.options);
|
||||
writeln("\nEnvironment:\n",
|
||||
"\tNO_COLOR\tsee https://no-color.org");
|
||||
}
|
||||
|
||||
void main(string[] argv) {
|
||||
Opts opts = defaultOpts();
|
||||
|
||||
try {
|
||||
|
||||
GetoptResult args = getopt(
|
||||
argv,
|
||||
std.getopt.config.bundling,
|
||||
@ -43,9 +51,11 @@ void main(string[] argv) {
|
||||
);
|
||||
|
||||
if (args.helpWanted) {
|
||||
defaultGetoptPrinter("prim prompt:\n", args.options);
|
||||
writeln("\nEnvironment:\n",
|
||||
"\tNO_COLOR\tsee https://no-color.org");
|
||||
printHelp(args);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
writeln(e.msg);
|
||||
writeln("try '--help' for more information");
|
||||
}
|
||||
|
||||
dorun(opts);
|
||||
|
Loading…
Reference in New Issue
Block a user