Open ndmitchell opened 9 years ago
I completely agree that typing an invalid flag should show help in addition to failing, but why not add -h
to the list of default help flags as a step in the right direction? My first impulse after seeing Unknown flag: <flag>
is to run the program again with -h
. The current defaults are -?
and --help
, and I can't even type -?
in ZSH without escaping it as -\?
.
From http://code.google.com/p/ndmitchell/issues/detail?id=418
Compare ghc (not cmdargs) with Hoogle (cmdargs):
Usage: For basic information, try the `--help' option.
Using cmdArgsRun, it should always output try the --help option (assuming the help option hasn't been renamed). Suggested by Nick Wu.
And an additional possible idea from bug #425 :
An alternative would be to define a variant of cmdArgsRun which interprets null getArgs to mean that it should print the help message (perhaps with a Bool argument to turn this on and off). Ideally, this variant would also allow other configurations like where to direct the printed output, etc, which could all be bundled together into a CmdArgsRunConfig argument.
@jfeltz remarked: This may be totally out of context, but with 0.10.2 I've gotten around this by calling Explicit.process directly:
This seems to work. Though I'm not sure what the full consequences/implications here are, I've just started using the library.
(Thanks @jfeltz for the suggestion, I had missed it on the Google bug tracker, but I've got it written down now for when I go through the GitHub tracker.)