You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Usage: For basic information, try the `--help' option.
$ hoogle -h
Unknown flag: -h
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:
import qualified System.Console.CmdArgs.Explicit as Exp
mode :: Mode (CmdArgs ProgramName)
mode = ...
main :: IO ()
main =
env_args <- getArgs
case (Exp.process mode env_args) of
Right res ->
case (cmdArgsHelp res) of
Just h -> putStr h
Nothing -> myHandleResultFunction $ cmdArgsValue res
Left err -> putStr $ err ++ "\n " ++ "(--help for assistance)\n"
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.)
The text was updated successfully, but these errors were encountered:
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.)
The text was updated successfully, but these errors were encountered: