args icon indicating copy to clipboard operation
args copied to clipboard

Create parser.addHelp()

Open lascarayf opened this issue 10 years ago • 5 comments

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
    • ?
    • /?

lascarayf avatar Aug 05 '15 23:08 lascarayf

+1

I spent some time reading over to docs expecting to find this flag.

jbdeboer avatar Oct 06 '15 21:10 jbdeboer

You may be interested in unscripted which has native support for this and many other high level features.

seaneagan avatar Oct 07 '15 18:10 seaneagan

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 avatar Oct 31 '16 19:10 srawlins

@srawlins That's a different thing. You can customize that by overriding ComandRunner.usage to caller super.usage and modify the result.

nex3 avatar Oct 31 '16 19:10 nex3

Ah, I see. Thanks!

srawlins avatar Oct 31 '16 20:10 srawlins