would like to react to --version before --help, cmdargs does it first though
This commit is contained in:
parent
870c687f31
commit
b39c0f8819
@ -82,8 +82,8 @@ main = do
|
|||||||
| cmd `isPrefixOf` "binaryfilename" = showModeHelpOr binaryfilenamemode $ putStrLn $ binaryfilename progname
|
| cmd `isPrefixOf` "binaryfilename" = showModeHelpOr binaryfilenamemode $ putStrLn $ binaryfilename progname
|
||||||
| otherwise = showModeHelpOr mainmode $ optserror $ "command "++cmd++" is not recognized"
|
| otherwise = showModeHelpOr mainmode $ optserror $ "command "++cmd++" is not recognized"
|
||||||
showModeHelpOr mode f = do
|
showModeHelpOr mode f = do
|
||||||
when ("help" `in_` (rawopts_ opts)) $ printModeHelpAndExit mode
|
|
||||||
when ("version" `in_` (rawopts_ opts)) $ printVersionAndExit
|
when ("version" `in_` (rawopts_ opts)) $ printVersionAndExit
|
||||||
|
when ("help" `in_` (rawopts_ opts)) $ printModeHelpAndExit mode
|
||||||
f
|
f
|
||||||
|
|
||||||
{- tests:
|
{- tests:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user