;doc: bal: clarify --layout a little

This commit is contained in:
Simon Michael 2021-12-05 10:56:17 -10:00
parent 1ba25f9714
commit 371539e085

View File

@ -286,8 +286,11 @@ With `--layout`, you can control how amounts with more than one commodity are di
- `--layout=wide[,WIDTH]`: on a single line, possibly elided to the specified width
- `--layout=tall`: each commodity is displayed on a separate line
- `--layout=bare`: commodity symbols are displayed in a separate column, and amounts are displayed as bare numbers
- `--layout=bare`: amounts are displayed as bare numbers, with commodity symbols in a separate column
Examples:
- Wide layout. With many commodities, reports can be very wide:
```shell
$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=wide
Balance changes in 2012-01-01..2014-12-31:
@ -297,7 +300,10 @@ Balance changes in 2012-01-01..2014-12-31:
Assets:US:ETrade || 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT -11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT
------------------++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|| 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT -11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT
```
- Limited wide layout. A width limit reduces the width, but some commodities will be hidden:
```shell
$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=wide,32
Balance changes in 2012-01-01..2014-12-31:
@ -306,7 +312,10 @@ Balance changes in 2012-01-01..2014-12-31:
Assets:US:ETrade || 10.00 ITOT, 337.18 USD, 2 more.. 70.00 GLD, 18.00 ITOT, 3 more.. -11.00 ITOT, 3 more.. 70.00 GLD, 17.00 ITOT, 3 more..
------------------++---------------------------------------------------------------------------------------------------------------------------
|| 10.00 ITOT, 337.18 USD, 2 more.. 70.00 GLD, 18.00 ITOT, 3 more.. -11.00 ITOT, 3 more.. 70.00 GLD, 17.00 ITOT, 3 more..
```
- Tall layout. Each commodity gets a new line (may be different in each column), and account names are repeated:
```shell
$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=tall
Balance changes in 2012-01-01..2014-12-31:
@ -323,7 +332,10 @@ Balance changes in 2012-01-01..2014-12-31:
|| 12.00 VEA -98.12 USD 14.00 VEA 5120.50 USD
|| 106.00 VHT 10.00 VEA 170.00 VHT 36.00 VEA
|| 18.00 VHT 294.00 VHT
```
- Bare layout. Commodity symbols are kept in one column, each commodity gets its own report row, account names are repeated:
```shell
$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=bare
Balance changes in 2012-01-01..2014-12-31:
@ -342,15 +354,9 @@ Balance changes in 2012-01-01..2014-12-31:
|| VHT 106.00 18.00 170.00 294.00
```
The option `--layout=bare` also affects [CSV output](#output-format),
- Bare layout also affects [CSV output](#output-format),
which is useful for producing data that is easier to consume, eg when making charts:
```shell
$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -O csv
"account","balance"
"Assets:US:ETrade","70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT"
"total","70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT"
$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -O csv --layout=bare
"account","commodity","balance"
"Assets:US:ETrade","GLD","70.00"