make --width and --debug require an argument (fixes #149)
This is a workaround for a cmdargs limitation. Having "--debug 2" or "--width 100" produce no output (because the number is parsed as a separate argument) is too annoying.
This commit is contained in:
parent
c31710d942
commit
3669422bbf
@ -81,7 +81,7 @@ helpflags :: [Flag RawOpts]
|
||||
helpflags = [
|
||||
flagNone ["help","h"] (setboolopt "help") "show general help or (after command) command help"
|
||||
-- ,flagNone ["browse-args"] (setboolopt "browse-args") "use a web UI to select options and build up a command line"
|
||||
,flagOpt "1" ["debug"] (\s opts -> Right $ setopt "debug" s opts) "N" "show debug output (increase N for more)"
|
||||
,flagReq ["debug"] (\s opts -> Right $ setopt "debug" s opts) "N" "show debug output (increase N for more detail)"
|
||||
,flagNone ["version"] (setboolopt "version") "show version information"
|
||||
]
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ registermode = (defCommandMode $ ["register"] ++ aliases) {
|
||||
flagNone ["historical","H"] (\opts -> setboolopt "historical" opts) "include prior postings in the running total"
|
||||
,flagNone ["average","A"] (\opts -> setboolopt "average" opts) "show a running average instead of the running total"
|
||||
,flagNone ["related","r"] (\opts -> setboolopt "related" opts) "show postings' siblings instead"
|
||||
,flagOpt (show defaultWidthWithFlag) ["width","w"] (\s opts -> Right $ setopt "width" s opts) "N" "set output width to 120, or N (default: 80)"
|
||||
,flagReq ["width","w"] (\s opts -> Right $ setopt "width" s opts) "N" "set output width (default: 80)"
|
||||
]
|
||||
,groupHidden = []
|
||||
,groupNamed = [generalflagsgroup1]
|
||||
|
||||
@ -122,12 +122,12 @@ hledgerdev --daily register
|
||||
>>>=1
|
||||
|
||||
# 12. help and input flags can go before command
|
||||
hledgerdev -f /dev/null --alias somealiases --rules-file -? -h --help --version --debug register --daily
|
||||
hledgerdev -f /dev/null --alias somealiases --rules-file -? -h --help --version --debug 1 register --daily
|
||||
>>> /^hledger \[COMMAND\]/
|
||||
>>>=0
|
||||
|
||||
# 13. or after it, and spaces in options are optional
|
||||
hledgerdev register -f/dev/null --alias=somealiases --rules-file -? -h --help --version --debug --daily
|
||||
hledgerdev register -f/dev/null --alias=somealiases --rules-file -? -h --help --version --debug 1 --daily
|
||||
>>> /^register \[OPTIONS\]/
|
||||
>>>=0
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user