cli: Use new mixed amount display functions for balance format strings.
This commit is contained in:
parent
b39de5989f
commit
e9a16edb58
@ -410,7 +410,7 @@ renderComponent opts (acctname, depth, total) (FormatField ljust min max field)
|
|||||||
Just m -> depth * m
|
Just m -> depth * m
|
||||||
Nothing -> depth
|
Nothing -> depth
|
||||||
AccountField -> formatString ljust min max (T.unpack acctname)
|
AccountField -> formatString ljust min max (T.unpack acctname)
|
||||||
TotalField -> fitStringMulti min max True False $ showMixedAmountWithoutPrice (color_ opts) total
|
TotalField -> fst $ showMixed showAmountWithoutPrice min max (color_ opts) total
|
||||||
_ -> ""
|
_ -> ""
|
||||||
|
|
||||||
-- | Render one StringFormat component for a balance report item.
|
-- | Render one StringFormat component for a balance report item.
|
||||||
@ -425,9 +425,7 @@ renderComponent1 opts (acctname, depth, total) (FormatField ljust min max field)
|
|||||||
-- better to indent the account name here rather than use a DepthField component
|
-- better to indent the account name here rather than use a DepthField component
|
||||||
-- so that it complies with width spec. Uses a fixed indent step size.
|
-- so that it complies with width spec. Uses a fixed indent step size.
|
||||||
indented = ((replicate (depth*2) ' ')++)
|
indented = ((replicate (depth*2) ' ')++)
|
||||||
TotalField -> fitStringMulti min max True False $ ((intercalate ", " . map strip . lines) (showamt total))
|
TotalField -> fst $ showMixedOneLine showAmountWithoutPrice min max (color_ opts) total
|
||||||
where
|
|
||||||
showamt = showMixedAmountWithoutPrice (color_ opts)
|
|
||||||
_ -> ""
|
_ -> ""
|
||||||
|
|
||||||
-- rendering multi-column balance reports
|
-- rendering multi-column balance reports
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
hledger -f sample.journal balance --tree --format="%30(account) %-.20(total)"
|
$ hledger -f sample.journal balance --tree --format="%30(account) %-.20(total)"
|
||||||
>>>
|
>
|
||||||
assets $-1
|
assets $-1
|
||||||
bank:saving $1
|
bank:saving $1
|
||||||
cash $-2
|
cash $-2
|
||||||
@ -12,4 +12,23 @@ hledger -f sample.journal balance --tree --format="%30(account) %-.20(total)"
|
|||||||
liabilities:debts $1
|
liabilities:debts $1
|
||||||
----------------------------------
|
----------------------------------
|
||||||
0
|
0
|
||||||
>>>= 0
|
>= 0
|
||||||
|
|
||||||
|
<
|
||||||
|
2020-09-01 Test
|
||||||
|
a -500 AAA
|
||||||
|
b
|
||||||
|
|
||||||
|
# Test too-small maximum balance widths
|
||||||
|
$ hledger -f - balance -N --format="%7.7(total) %(account)"
|
||||||
|
>
|
||||||
|
1 mor.. a
|
||||||
|
500 AAA b
|
||||||
|
>= 0
|
||||||
|
|
||||||
|
# Check that maximum balance widths works with colour
|
||||||
|
$ hledger -f - balance -N --format="%8.8(total) %(account)" --color=yes
|
||||||
|
>
|
||||||
|
[31m-500 AAA[m a
|
||||||
|
500 AAA b
|
||||||
|
>= 0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user