diff --git a/hledger-ui/Hledger/UI/UIOptions.hs b/hledger-ui/Hledger/UI/UIOptions.hs index 4ef7bf454..26dbd9b1a 100644 --- a/hledger-ui/Hledger/UI/UIOptions.hs +++ b/hledger-ui/Hledger/UI/UIOptions.hs @@ -51,7 +51,7 @@ uimode = (mode "hledger-ui" [("command","ui")] (argsFlag "[PATTERNS]") []){ modeGroupFlags = Group { groupUnnamed = uiflags - ,groupHidden = [] + ,groupHidden = hiddenflags ,groupNamed = [(generalflagsgroup1)] } ,modeHelpSuffix=[ diff --git a/hledger-web/Hledger/Web/WebOptions.hs b/hledger-web/Hledger/Web/WebOptions.hs index d6f6411a6..a222ac011 100644 --- a/hledger-web/Hledger/Web/WebOptions.hs +++ b/hledger-web/Hledger/Web/WebOptions.hs @@ -75,6 +75,7 @@ webmode = Group { groupUnnamed = webflags , groupHidden = + hiddenflags ++ [ flagNone ["binary-filename"] (setboolopt "binary-filename") diff --git a/hledger/Hledger/Cli/CliOptions.hs b/hledger/Hledger/Cli/CliOptions.hs index ff6c0b449..bc13e426b 100644 --- a/hledger/Hledger/Cli/CliOptions.hs +++ b/hledger/Hledger/Cli/CliOptions.hs @@ -12,6 +12,7 @@ module Hledger.Cli.CliOptions ( -- * cmdargs flags & modes helpflags, detailedversionflag, + hiddenflags, inputflags, reportflags, outputflags, @@ -112,7 +113,7 @@ helpflags = [ ,flagNone ["version"] (setboolopt "version") "show version information" ] --- | A hidden flag, just for the hledger executable. +-- | A hidden flag just for the hledger executable. detailedversionflag :: Flag RawOpts detailedversionflag = flagNone ["version+"] (setboolopt "version+") "show version information with extra detail" @@ -141,7 +142,7 @@ reportflags = [ ,flagNone ["quarterly","Q"] (setboolopt "quarterly") "multiperiod/multicolumn report by quarter" ,flagNone ["yearly","Y"] (setboolopt "yearly") "multiperiod/multicolumn report by year" ,flagReq ["period","p"] (\s opts -> Right $ setopt "period" s opts) "PERIODEXP" "set start date, end date, and/or report interval all at once (overrides the flags above)" - ,flagNone ["date2"] (setboolopt "date2") "match the secondary date instead (see command help for other effects)" + ,flagNone ["date2"] (setboolopt "date2") "match the secondary date instead. See command help for other effects. (--effective, --aux-date also accepted)" -- see also hiddenflags -- status/realness/depth/zero filters ,flagNone ["unmarked","U"] (setboolopt "unmarked") "include only unmarked postings/txns (can combine with -P or -C)" @@ -184,6 +185,13 @@ reportflags = [ ] +-- | Common flags that are accepted but not shown in --help, +-- such as --effective, --aux-date. +hiddenflags :: [Flag RawOpts] +hiddenflags = [ + flagNone ["effective","aux-date"] (setboolopt "date2") "Ledger-compatible aliases for --date2" + ] + -- | Common output-related flags: --output-file, --output-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, html." @@ -262,8 +270,8 @@ addonCommandMode name = (defCommandMode [name]) { -- ] ,modeGroupFlags = Group { groupUnnamed = [] - ,groupHidden = [] - ,groupNamed = [generalflagsgroup1] + ,groupHidden = hiddenflags + ,groupNamed = [generalflagsgroup1] } } diff --git a/hledger/Hledger/Cli/Commands/Accounts.hs b/hledger/Hledger/Cli/Commands/Accounts.hs index 2bed0d1b5..57ac1b11e 100644 --- a/hledger/Hledger/Cli/Commands/Accounts.hs +++ b/hledger/Hledger/Cli/Commands/Accounts.hs @@ -43,7 +43,7 @@ accountsmode = hledgerCommandMode ,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts" ] [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "[QUERY]") -- | The accounts command. diff --git a/hledger/Hledger/Cli/Commands/Activity.hs b/hledger/Hledger/Cli/Commands/Activity.hs index 7b4342070..78a4d023d 100644 --- a/hledger/Hledger/Cli/Commands/Activity.hs +++ b/hledger/Hledger/Cli/Commands/Activity.hs @@ -22,7 +22,7 @@ activitymode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Activity.txt") [] [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "[QUERY]") barchar :: Char diff --git a/hledger/Hledger/Cli/Commands/Balance.hs b/hledger/Hledger/Cli/Commands/Balance.hs index 03d7a5ae0..600899549 100644 --- a/hledger/Hledger/Cli/Commands/Balance.hs +++ b/hledger/Hledger/Cli/Commands/Balance.hs @@ -296,7 +296,7 @@ balancemode = hledgerCommandMode ++ outputflags ) [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "[QUERY]") -- | The balance command, prints a balance report. diff --git a/hledger/Hledger/Cli/Commands/Checkdates.hs b/hledger/Hledger/Cli/Commands/Checkdates.hs index 2107a8f8c..8084b447a 100755 --- a/hledger/Hledger/Cli/Commands/Checkdates.hs +++ b/hledger/Hledger/Cli/Commands/Checkdates.hs @@ -16,7 +16,7 @@ checkdatesmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Checkdates.txt") [flagNone ["strict"] (setboolopt "strict") "makes date comparing strict"] [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "[QUERY]") checkdates :: CliOpts -> Journal -> IO () diff --git a/hledger/Hledger/Cli/Commands/Checkdupes.hs b/hledger/Hledger/Cli/Commands/Checkdupes.hs index 5e7407a8b..b4d34bdf6 100755 --- a/hledger/Hledger/Cli/Commands/Checkdupes.hs +++ b/hledger/Hledger/Cli/Commands/Checkdupes.hs @@ -19,7 +19,7 @@ checkdupesmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Checkdupes.txt") [] [generalflagsgroup1] - [] + hiddenflags ([], Nothing) checkdupes _opts j = mapM_ render $ checkdupes' $ accountsNames j diff --git a/hledger/Hledger/Cli/Commands/Close.hs b/hledger/Hledger/Cli/Commands/Close.hs index 389c15180..c363f3c20 100755 --- a/hledger/Hledger/Cli/Commands/Close.hs +++ b/hledger/Hledger/Cli/Commands/Close.hs @@ -21,7 +21,7 @@ closemode = hledgerCommandMode ,flagNone ["closing"] (setboolopt "closing") "show just closing transaction" ] [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "[QUERY]") close CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do diff --git a/hledger/Hledger/Cli/Commands/Import.hs b/hledger/Hledger/Cli/Commands/Import.hs index 7ad5b71b0..7edfd9fa6 100755 --- a/hledger/Hledger/Cli/Commands/Import.hs +++ b/hledger/Hledger/Cli/Commands/Import.hs @@ -20,7 +20,7 @@ importmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Import.txt") [flagNone ["dry-run"] (setboolopt "dry-run") "just show the transactions to be imported"] [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "FILE [...]") importcmd opts@CliOpts{rawopts_=rawopts,inputopts_=iopts} j = do diff --git a/hledger/Hledger/Cli/Commands/Prices.hs b/hledger/Hledger/Cli/Commands/Prices.hs index 8a066ee15..6a9ec0ab6 100755 --- a/hledger/Hledger/Cli/Commands/Prices.hs +++ b/hledger/Hledger/Cli/Commands/Prices.hs @@ -19,7 +19,7 @@ pricesmode = hledgerCommandMode [flagNone ["costs"] (setboolopt "costs") "print transaction prices from postings" ,flagNone ["inverted-costs"] (setboolopt "inverted-costs") "print transaction inverted prices from postings also"] [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "[QUERY]") -- XXX the original hledger-prices script always ignored assertions diff --git a/hledger/Hledger/Cli/Commands/Print.hs b/hledger/Hledger/Cli/Commands/Print.hs index 5e4570272..e2b4b2c56 100644 --- a/hledger/Hledger/Cli/Commands/Print.hs +++ b/hledger/Hledger/Cli/Commands/Print.hs @@ -37,7 +37,7 @@ printmode = hledgerCommandMode "show only newer-dated transactions added in each file since last run" ] ++ outputflags) [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "[QUERY]") -- | Print journal transactions in standard format. diff --git a/hledger/Hledger/Cli/Commands/Printunique.hs b/hledger/Hledger/Cli/Commands/Printunique.hs index 77e87b6d4..cfa9d64d7 100755 --- a/hledger/Hledger/Cli/Commands/Printunique.hs +++ b/hledger/Hledger/Cli/Commands/Printunique.hs @@ -15,7 +15,7 @@ printuniquemode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Printunique.txt") [] [generalflagsgroup1] - [] + hiddenflags ([], Nothing) printunique opts j@Journal{jtxns=ts} = do diff --git a/hledger/Hledger/Cli/Commands/Register.hs b/hledger/Hledger/Cli/Commands/Register.hs index 5a5692c7c..5bb47838a 100644 --- a/hledger/Hledger/Cli/Commands/Register.hs +++ b/hledger/Hledger/Cli/Commands/Register.hs @@ -50,7 +50,7 @@ registermode = hledgerCommandMode ) ] ++ outputflags) [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "[QUERY]") -- | Print a (posting) register report. diff --git a/hledger/Hledger/Cli/Commands/Registermatch.hs b/hledger/Hledger/Cli/Commands/Registermatch.hs index fafd2dcf2..a4e30db80 100755 --- a/hledger/Hledger/Cli/Commands/Registermatch.hs +++ b/hledger/Hledger/Cli/Commands/Registermatch.hs @@ -18,7 +18,7 @@ registermatchmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Registermatch.txt") [] [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "DESC") registermatch :: CliOpts -> Journal -> IO () diff --git a/hledger/Hledger/Cli/Commands/Rewrite.hs b/hledger/Hledger/Cli/Commands/Rewrite.hs index afd02f3b3..04ef55d44 100755 --- a/hledger/Hledger/Cli/Commands/Rewrite.hs +++ b/hledger/Hledger/Cli/Commands/Rewrite.hs @@ -29,7 +29,7 @@ rewritemode = hledgerCommandMode ,flagNone ["diff"] (setboolopt "diff") "generate diff suitable as an input for patch tool" ] [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "[QUERY] --add-posting \"ACCT AMTEXPR\" ...") -- TODO regex matching and interpolating matched name in replacement diff --git a/hledger/Hledger/Cli/Commands/Roi.hs b/hledger/Hledger/Cli/Commands/Roi.hs index 896d65d5f..0be3fd6cf 100644 --- a/hledger/Hledger/Cli/Commands/Roi.hs +++ b/hledger/Hledger/Cli/Commands/Roi.hs @@ -37,7 +37,7 @@ roimode = hledgerCommandMode "query to select profit-and-loss or appreciation/valuation transactions" ] [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "[QUERY]") -- One reporting span, diff --git a/hledger/Hledger/Cli/Commands/Stats.hs b/hledger/Hledger/Cli/Commands/Stats.hs index 1b48e195c..755c4ccb7 100644 --- a/hledger/Hledger/Cli/Commands/Stats.hs +++ b/hledger/Hledger/Cli/Commands/Stats.hs @@ -35,7 +35,7 @@ statsmode = hledgerCommandMode [flagReq ["output-file","o"] (\s opts -> Right $ setopt "output-file" s opts) "FILE" "write output to FILE." ] [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "[QUERY]") -- like Register.summarisePostings diff --git a/hledger/Hledger/Cli/Commands/Tags.hs b/hledger/Hledger/Cli/Commands/Tags.hs index 789a14e37..9ea499eb7 100755 --- a/hledger/Hledger/Cli/Commands/Tags.hs +++ b/hledger/Hledger/Cli/Commands/Tags.hs @@ -17,7 +17,7 @@ tagsmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Tags.txt") [] -- [flagNone ["strict"] (setboolopt "strict") "makes date comparing strict"] -- [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "[TAGREGEX [QUERY...]]") tags CliOpts{rawopts_=rawopts,reportopts_=ropts} j = do diff --git a/hledger/Hledger/Cli/CompoundBalanceCommand.hs b/hledger/Hledger/Cli/CompoundBalanceCommand.hs index 6bfe7fbd2..97f1662c5 100644 --- a/hledger/Hledger/Cli/CompoundBalanceCommand.hs +++ b/hledger/Hledger/Cli/CompoundBalanceCommand.hs @@ -108,7 +108,7 @@ compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = ,outputFileFlag ] [generalflagsgroup1] - [] + hiddenflags ([], Just $ argsFlag "[QUERY]") where defType :: BalanceType -> String