mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-19 10:17:35 +03:00
cli: restore --aux-date and --effective as --date2 aliases (#1034)
These Ledger-ish spellings were dropped over the years, to improve --help's layout. Now they work again, but are considered hidden flags so --help doesn't show them automatically (but I decided to mention them manually in --date2's description).
This commit is contained in:
parent
41fecde188
commit
faf85d91e3
@ -51,7 +51,7 @@ uimode = (mode "hledger-ui" [("command","ui")]
|
||||
(argsFlag "[PATTERNS]") []){
|
||||
modeGroupFlags = Group {
|
||||
groupUnnamed = uiflags
|
||||
,groupHidden = []
|
||||
,groupHidden = hiddenflags
|
||||
,groupNamed = [(generalflagsgroup1)]
|
||||
}
|
||||
,modeHelpSuffix=[
|
||||
|
@ -75,6 +75,7 @@ webmode =
|
||||
Group
|
||||
{ groupUnnamed = webflags
|
||||
, groupHidden =
|
||||
hiddenflags ++
|
||||
[ flagNone
|
||||
["binary-filename"]
|
||||
(setboolopt "binary-filename")
|
||||
|
@ -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]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -22,7 +22,7 @@ activitymode = hledgerCommandMode
|
||||
$(embedFileRelative "Hledger/Cli/Commands/Activity.txt")
|
||||
[]
|
||||
[generalflagsgroup1]
|
||||
[]
|
||||
hiddenflags
|
||||
([], Just $ argsFlag "[QUERY]")
|
||||
|
||||
barchar :: Char
|
||||
|
@ -296,7 +296,7 @@ balancemode = hledgerCommandMode
|
||||
++ outputflags
|
||||
)
|
||||
[generalflagsgroup1]
|
||||
[]
|
||||
hiddenflags
|
||||
([], Just $ argsFlag "[QUERY]")
|
||||
|
||||
-- | The balance command, prints a balance report.
|
||||
|
@ -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 ()
|
||||
|
@ -19,7 +19,7 @@ checkdupesmode = hledgerCommandMode
|
||||
$(embedFileRelative "Hledger/Cli/Commands/Checkdupes.txt")
|
||||
[]
|
||||
[generalflagsgroup1]
|
||||
[]
|
||||
hiddenflags
|
||||
([], Nothing)
|
||||
|
||||
checkdupes _opts j = mapM_ render $ checkdupes' $ accountsNames j
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -15,7 +15,7 @@ printuniquemode = hledgerCommandMode
|
||||
$(embedFileRelative "Hledger/Cli/Commands/Printunique.txt")
|
||||
[]
|
||||
[generalflagsgroup1]
|
||||
[]
|
||||
hiddenflags
|
||||
([], Nothing)
|
||||
|
||||
printunique opts j@Journal{jtxns=ts} = do
|
||||
|
@ -50,7 +50,7 @@ registermode = hledgerCommandMode
|
||||
)
|
||||
] ++ outputflags)
|
||||
[generalflagsgroup1]
|
||||
[]
|
||||
hiddenflags
|
||||
([], Just $ argsFlag "[QUERY]")
|
||||
|
||||
-- | Print a (posting) register report.
|
||||
|
@ -18,7 +18,7 @@ registermatchmode = hledgerCommandMode
|
||||
$(embedFileRelative "Hledger/Cli/Commands/Registermatch.txt")
|
||||
[]
|
||||
[generalflagsgroup1]
|
||||
[]
|
||||
hiddenflags
|
||||
([], Just $ argsFlag "DESC")
|
||||
|
||||
registermatch :: CliOpts -> Journal -> IO ()
|
||||
|
@ -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
|
||||
|
@ -37,7 +37,7 @@ roimode = hledgerCommandMode
|
||||
"query to select profit-and-loss or appreciation/valuation transactions"
|
||||
]
|
||||
[generalflagsgroup1]
|
||||
[]
|
||||
hiddenflags
|
||||
([], Just $ argsFlag "[QUERY]")
|
||||
|
||||
-- One reporting span,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -108,7 +108,7 @@ compoundBalanceCommandMode CompoundBalanceCommandSpec{..} =
|
||||
,outputFileFlag
|
||||
]
|
||||
[generalflagsgroup1]
|
||||
[]
|
||||
hiddenflags
|
||||
([], Just $ argsFlag "[QUERY]")
|
||||
where
|
||||
defType :: BalanceType -> String
|
||||
|
Loading…
Reference in New Issue
Block a user