mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-25 19:31:44 +03:00
imp: cli: make some reporting flags toggle on/off when repeated
This can be useful to override defaults in scripts. These flags will now toggle when repeated on the command line: --invert --transpose -r/--related -%/--percent -E/--empty -N/--no-total -T/--row-total -A/--average -S/--sort-amount
This commit is contained in:
parent
8735af77df
commit
57c0205107
@ -243,13 +243,13 @@ rawOptsToReportOpts d rawopts =
|
|||||||
,infer_prices_ = boolopt "infer-market-prices" rawopts
|
,infer_prices_ = boolopt "infer-market-prices" rawopts
|
||||||
,depth_ = maybeposintopt "depth" rawopts
|
,depth_ = maybeposintopt "depth" rawopts
|
||||||
,date2_ = boolopt "date2" rawopts
|
,date2_ = boolopt "date2" rawopts
|
||||||
,empty_ = boolopt "empty" rawopts
|
,empty_ = toggleopt "empty" rawopts
|
||||||
,no_elide_ = boolopt "no-elide" rawopts
|
,no_elide_ = boolopt "no-elide" rawopts
|
||||||
,real_ = boolopt "real" rawopts
|
,real_ = boolopt "real" rawopts
|
||||||
,format_ = format
|
,format_ = format
|
||||||
,querystring_ = querystring
|
,querystring_ = querystring
|
||||||
,average_ = boolopt "average" rawopts
|
,average_ = toggleopt "average" rawopts
|
||||||
,related_ = boolopt "related" rawopts
|
,related_ = toggleopt "related" rawopts
|
||||||
,txn_dates_ = boolopt "txn-dates" rawopts
|
,txn_dates_ = boolopt "txn-dates" rawopts
|
||||||
,balancecalc_ = balancecalcopt rawopts
|
,balancecalc_ = balancecalcopt rawopts
|
||||||
,balanceaccum_ = balanceaccumopt rawopts
|
,balanceaccum_ = balanceaccumopt rawopts
|
||||||
@ -257,15 +257,15 @@ rawOptsToReportOpts d rawopts =
|
|||||||
,accountlistmode_ = accountlistmodeopt rawopts
|
,accountlistmode_ = accountlistmodeopt rawopts
|
||||||
,drop_ = posintopt "drop" rawopts
|
,drop_ = posintopt "drop" rawopts
|
||||||
,declared_ = boolopt "declared" rawopts
|
,declared_ = boolopt "declared" rawopts
|
||||||
,row_total_ = boolopt "row-total" rawopts
|
,row_total_ = toggleopt "row-total" rawopts
|
||||||
,no_total_ = boolopt "no-total" rawopts
|
,no_total_ = toggleopt "no-total" rawopts
|
||||||
,show_costs_ = boolopt "show-costs" rawopts
|
,show_costs_ = boolopt "show-costs" rawopts
|
||||||
,sort_amount_ = boolopt "sort-amount" rawopts
|
,sort_amount_ = toggleopt "sort-amount" rawopts
|
||||||
,percent_ = boolopt "percent" rawopts
|
,percent_ = toggleopt "percent" rawopts
|
||||||
,invert_ = boolopt "invert" rawopts
|
,invert_ = toggleopt "invert" rawopts
|
||||||
,pretty_ = pretty
|
,pretty_ = pretty
|
||||||
,color_ = useColorOnStdout -- a lower-level helper
|
,color_ = useColorOnStdout -- a lower-level helper
|
||||||
,transpose_ = boolopt "transpose" rawopts
|
,transpose_ = toggleopt "transpose" rawopts
|
||||||
,layout_ = layoutopt rawopts
|
,layout_ = layoutopt rawopts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +114,20 @@ General reporting options:
|
|||||||
|
|
||||||
_reportingoptions_
|
_reportingoptions_
|
||||||
|
|
||||||
|
## Option repetition
|
||||||
|
|
||||||
|
If options are repeated in a command line, hledger will generally use the last (right-most) occurence.
|
||||||
|
Some of the boolean flags will toggle if repeated; these include:
|
||||||
|
`--invert`,
|
||||||
|
`--transpose`,
|
||||||
|
`-r/--related`,
|
||||||
|
`-%/--percent`,
|
||||||
|
`-E/--empty`,
|
||||||
|
`-N/--no-total`,
|
||||||
|
`-T/--row-total`,
|
||||||
|
`-A/--average`, and
|
||||||
|
`-S/--sort-amount`.
|
||||||
|
|
||||||
## Command options
|
## Command options
|
||||||
|
|
||||||
To see options for a particular command, including command-specific options, run: `hledger COMMAND -h`.
|
To see options for a particular command, including command-specific options, run: `hledger COMMAND -h`.
|
||||||
|
Loading…
Reference in New Issue
Block a user