;bal: improve -S docs (#1283, #1379)

This commit is contained in:
Simon Michael 2020-11-05 10:59:01 -10:00
parent 166951dc69
commit 10facfdb50

View File

@ -43,9 +43,9 @@ $ hledger balance
0 0
``` ```
By default, accounts are displayed hierarchically, with subaccounts indented below their parent. By default, accounts are displayed hierarchically,
At each level of the tree, accounts are sorted by [account code](/journal.html#declaring-accounts) if any, then by account name. with subaccounts indented below their parent,
Or with `-S/--sort-amount`, by their balance amount, largest first. with accounts at each level of the tree sorted by [declaration order](/journal.html#declaring-accounts) if declared, then by account name.
"Boring" accounts, which contain a single interesting subaccount and "Boring" accounts, which contain a single interesting subaccount and
no balance of their own, are elided into the following line for more compact output. no balance of their own, are elided into the following line for more compact output.
@ -184,6 +184,16 @@ This flag does not work if the report contains any mixed commodity accounts. If
there are mixed commodity accounts in the report be sure to use `-V` there are mixed commodity accounts in the report be sure to use `-V`
or `-B` to coerce the report into using a single commodity. or `-B` to coerce the report into using a single commodity.
### Sorting by amount
With `-S`/`--sort-amount`, accounts with the largest (most positive) balances are shown first.
For example, `hledger bal expenses -MAS` shows your biggest averaged monthly expenses first.
Revenues and liability balances are typically negative, however, so `-S` shows these in reverse order (largest last).
To work around this, you can add `--invert` to flip the signs.
Or, use one of the sign-flipping report like `balancesheet` or `incomestatement`, which also support `-S`.
Eg: `hledger is -MAS`.
### Multicolumn balance report ### Multicolumn balance report
Multicolumn or tabular balance reports are a very useful hledger feature, Multicolumn or tabular balance reports are a very useful hledger feature,