lib: make output-file and output-format flags available separately

Kind of.. the output-file flag's help mentions output-format
This commit is contained in:
Simon Michael 2017-07-25 16:01:55 -07:00
parent f49756231a
commit 7204b1b9a1

View File

@ -15,6 +15,8 @@ module Hledger.Cli.CliOptions (
inputflags, inputflags,
reportflags, reportflags,
outputflags, outputflags,
outputFormatFlag,
outputFileFlag,
generalflagsgroup1, generalflagsgroup1,
generalflagsgroup2, generalflagsgroup2,
generalflagsgroup3, generalflagsgroup3,
@ -149,10 +151,9 @@ reportflags = [
] ]
-- | Common output-related flags: --output-file, --output-format... -- | Common output-related flags: --output-file, --output-format...
outputflags = [ outputflags = [outputFormatFlag, outputFileFlag]
flagReq ["output-format","O"] (\s opts -> Right $ setopt "output-format" s opts) "FMT" "select the output format. Supported formats:\ntxt, csv." outputFormatFlag = flagReq ["output-format","O"] (\s opts -> Right $ setopt "output-format" s opts) "FMT" "select the output format. Supported formats:\ntxt, csv."
,flagReq ["output-file","o"] (\s opts -> Right $ setopt "output-file" s opts) "FILE" "write output to FILE. A file extension matching one of the above formats selects that format." outputFileFlag = flagReq ["output-file","o"] (\s opts -> Right $ setopt "output-file" s opts) "FILE" "write output to FILE. A file extension matching one of the above formats selects that format."
]
argsFlag :: FlagHelp -> Arg RawOpts argsFlag :: FlagHelp -> Arg RawOpts
argsFlag desc = flagArg (\s opts -> Right $ setopt "args" s opts) desc argsFlag desc = flagArg (\s opts -> Right $ setopt "args" s opts) desc