hledger/tests/register/depth.test
Simon Michael 7f6cf1f849 balance, register, register-csv: depth 0 shows summary items (#206)
Previously, a depth:0 query produced an empty report (since there are no
level zero accounts). Now, it aggregates all data into one summary item
with account name "...".

This makes it easier to see the kind of data Gwern was looking for from
register-csv (net worth over time). Eg this shows one line per month
summarising the total of assets and liabilities:

hledger register-csv -- -MHE ^assets ^liabilities depth:0

Single and multi-column balance reports behave similarly.
2014-10-19 17:53:20 -07:00

82 lines
1.7 KiB
Plaintext

# 1. register --depth N matches postings as usual but clips account names to N
hledgerdev -f - register aa --depth 1
<<<
2010/1/1 x
a:aa:aaa 1
b
>>>
2010/01/01 x a 1 1
>>>=0
# 2. separate postings remain separate
hledgerdev -f - register aa --depth 2
<<<
2010/1/1 x
a:aa 1
b:bb:bbb
2010/1/1 y
a:aa 1
b:bb:bbb
2010/1/2 z
a:aa 1
b:bb:bbb
>>>
2010/01/01 x a:aa 1 1
2010/01/01 y a:aa 1 2
2010/01/02 z a:aa 1 3
>>>=0
# 3. with a reporting interval, all postings are aggregated under each (clipped) account
hledgerdev -f - register aa --depth 1 --daily
<<<
2010/1/1 x
a:aa 1
b:bb:bbb
2010/1/1 y
a:aa 1
b:bb:bbb
2010/1/2 z
a:aa 1
b:bb:bbb
>>>
2010/01/01d a 2 2
2010/01/02d a 1 3
>>>=0
# 4. with --cleared
hledgerdev -f - register a --depth 1 --cleared
<<<
2012/1/1 *
(a:aa) 1
>>>
2012/01/01 (a) 1 1
>>>2
>>>=0
# 5. depth 0 aggregates everything into a single line
hledgerdev -f - register --depth 0 --daily a b
<<<
2010/1/1 x
a:aa 1
b:bb 2
c:cc
2010/1/1 y
a:aa 1
b:bb 2
c:cc
2010/1/2 z
a:aa 1
b:bb 2
c:cc
>>>
2010/01/01d ... 6 6
2010/01/02d ... 3 9
>>>=0