From 7204b1b9a1a77c71ca796fec521289a58de8d88b Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 25 Jul 2017 16:01:55 -0700 Subject: [PATCH] lib: make output-file and output-format flags available separately Kind of.. the output-file flag's help mentions output-format --- hledger/Hledger/Cli/CliOptions.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hledger/Hledger/Cli/CliOptions.hs b/hledger/Hledger/Cli/CliOptions.hs index ad062b845..62170e984 100644 --- a/hledger/Hledger/Cli/CliOptions.hs +++ b/hledger/Hledger/Cli/CliOptions.hs @@ -15,6 +15,8 @@ module Hledger.Cli.CliOptions ( inputflags, reportflags, outputflags, + outputFormatFlag, + outputFileFlag, generalflagsgroup1, generalflagsgroup2, generalflagsgroup3, @@ -149,10 +151,9 @@ reportflags = [ ] -- | Common output-related flags: --output-file, --output-format... -outputflags = [ - 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." - ] +outputflags = [outputFormatFlag, outputFileFlag] +outputFormatFlag = flagReq ["output-format","O"] (\s opts -> Right $ setopt "output-format" s opts) "FMT" "select the output format. Supported formats:\ntxt, csv." +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 desc = flagArg (\s opts -> Right $ setopt "args" s opts) desc