bal, bs, cf, is: update flat/tree help; order options a bit better

This commit is contained in:
Simon Michael 2020-07-07 19:00:10 -07:00
parent f5e1fb2625
commit 09b1736d5a
4 changed files with 21 additions and 13 deletions

View File

@ -12,6 +12,7 @@ module Hledger.Cli.CliOptions (
-- * cmdargs flags & modes
helpflags,
detailedversionflag,
flattreeflags,
hiddenflags,
inputflags,
reportflags,
@ -190,6 +191,13 @@ reportflags = [
])
]
-- | Flags for selecting flat/tree mode, used in accounts/balance reports.
flattreeflags :: [Flag RawOpts]
flattreeflags = [
flagNone ["flat"] (setboolopt "flat") "show accounts as a list; amounts exclude subaccounts, except where account is depth-clipped"
,flagNone ["tree"] (setboolopt "tree") "show accounts as a tree; amounts include subaccounts"
]
-- | Common flags that are accepted but not shown in --help,
-- such as --effective, --aux-date.
hiddenflags :: [Flag RawOpts]

View File

@ -38,8 +38,8 @@ accountsmode = hledgerCommandMode
$(embedFileRelative "Hledger/Cli/Commands/Accounts.txt")
[flagNone ["declared"] (setboolopt "declared") "show account names declared with account directives"
,flagNone ["used"] (setboolopt "used") "show account names referenced by transactions"
,flagNone ["tree"] (setboolopt "tree") "show short account names, as a tree"
,flagNone ["flat"] (setboolopt "flat") "show full account names, as a list (default)"
,flagNone ["tree"] (setboolopt "tree") "show short account names, as a tree"
,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"
]
[generalflagsgroup1]

View File

@ -279,20 +279,20 @@ balancemode = hledgerCommandMode
"show balance change accumulated across periods (in multicolumn reports)"
,flagNone ["historical","H"] (setboolopt "historical")
"show historical ending balance in each period (includes postings before report start date)\n "
,flagNone ["tree"] (setboolopt "tree") "show accounts as a tree; amounts include subaccounts (default in simple reports)"
,flagNone ["flat"] (setboolopt "flat") "show accounts as a list; amounts exclude subaccounts except when account is depth-clipped (default in multicolumn reports)\n "
]
++ flattreeflags ++
[flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "omit N leading account name parts (in flat mode)"
,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)"
,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)"
,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row"
,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "omit N leading account name parts (in flat mode)"
,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode)"
,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"
,flagNone ["pretty-tables"] (setboolopt "pretty-tables") "use unicode to display prettier tables"
,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed."
,flagNone ["budget"] (setboolopt "budget") "show performance compared to budget goals defined by periodic transactions"
,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total"
,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign"
,flagNone ["transpose"] (setboolopt "transpose") "transpose rows and columns"
,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total"
,flagNone ["budget"] (setboolopt "budget") "show performance compared to budget goals defined by periodic transactions"
,outputFormatFlag ["txt","html","csv","json"]
,outputFileFlag
]

View File

@ -53,8 +53,8 @@ data CompoundBalanceCommandSpec = CompoundBalanceCommandSpec {
compoundBalanceCommandMode :: CompoundBalanceCommandSpec -> Mode RawOpts
compoundBalanceCommandMode CompoundBalanceCommandSpec{..} =
hledgerCommandMode
cbcdoc
[flagNone ["change"] (setboolopt "change")
cbcdoc
([flagNone ["change"] (setboolopt "change")
("show balance change in each period" ++ defType PeriodChange)
,flagNone ["cumulative"] (setboolopt "cumulative")
("show balance change accumulated across periods (in multicolumn reports)"
@ -64,12 +64,12 @@ compoundBalanceCommandMode CompoundBalanceCommandSpec{..} =
("show historical ending balance in each period (includes postings before report start date)"
++ defType HistoricalBalance
)
,flagNone ["flat"] (setboolopt "flat") "show accounts as a list"
,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"
,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row"
,flagNone ["tree"] (setboolopt "tree") "show accounts as a tree; amounts include subaccounts (default in simple reports)"
]
++ flattreeflags ++
[flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"
,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)"
,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)"
,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row"
,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode)"
,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"
,flagNone ["pretty-tables"] (setboolopt "pretty-tables") "use unicode when displaying tables"
@ -77,7 +77,7 @@ compoundBalanceCommandMode CompoundBalanceCommandSpec{..} =
,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total"
,outputFormatFlag ["txt","html","csv","json"]
,outputFileFlag
]
])
[generalflagsgroup1]
hiddenflags
([], Just $ argsFlag "[QUERY]")