Create parser.addHelp()
I think "help" is a special, well-known flag and has to have its own settings.
// Old
parser.addFlag('help', abbr: 'h', negatable: false,
help: "Displays this help information.");
// New
parser.addHelp();
Behavior
- Use default parameters
- Execute by default
stdout.writeln(parser.usage); exit(0); - Add an optional bool parameter to show help if the user does not pass any parameters (ej. dart command.dart)
- Accept by default
- --help
- -h
- help
- ?
- /?
+1
I spent some time reading over to docs expecting to find this flag.
You may be interested in unscripted which has native support for this and many other high level features.
I'm not certain this is the request, but I just want to control the one-line doc:
# default
Usage: mytool <command> [arguments]
# after .addHelp() or addUsage() or something:
Usage: mytool <command> [arguments] [file ...]
(that's when using CommandRunner I guess)
@srawlins That's a different thing. You can customize that by overriding ComandRunner.usage to caller super.usage and modify the result.
Ah, I see. Thanks!