imp!: balance: Stop eliding long amounts. (#1739)

This feature has caused a lot of confusion, and we now have better ways
of making sure columns don't get too wide.
This commit is contained in:
Stephen Morgan 2021-11-12 21:41:05 +11:00 committed by Simon Michael
parent 7e21f05a83
commit de2776c996
3 changed files with 13 additions and 26 deletions

View File

@ -312,7 +312,7 @@ balancemode = hledgerCommandMode
,flagNone ["related","r"] (setboolopt "related") "show postings' siblings instead"
,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)"
,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row"
,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode); don't show only 2 commodities per amount"
,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode)"
,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"
,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed."
,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total"
@ -731,10 +731,7 @@ multiBalanceRowAsTableText opts = multiBalanceRowAsWbs (balanceOpts True opts) o
-- | Amount display options to use for balance reports
balanceOpts :: Bool -> ReportOpts -> AmountDisplayOpts
balanceOpts isTable ReportOpts{..} = oneLine
{ displayColour = isTable && color_
, displayMaxWidth = if isTable && not no_elide_ then Just 32 else Nothing
}
balanceOpts isTable ReportOpts{..} = oneLine {displayColour = isTable && color_}
tests_Balance = testGroup "Balance" [

View File

@ -80,7 +80,7 @@ compoundBalanceCommandMode CompoundBalanceCommandSpec{..} =
,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)"
,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)"
,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row"
,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode); don't show only 2 commodities per amount"
,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode)"
,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"
,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name"
,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total"

View File

@ -1,4 +1,4 @@
# 1. In tabular balance reports, cap the maximum width and elide if sufficiently large
# 1. In tabular balance reports, display on a single line by default
<
2020-01-01
(a) 1.00A
@ -8,16 +8,6 @@
(a) 1.00E
(a) 1.00F
$ hledger -f- bal -Y
Balance changes in 2020:
|| 2020
===++===============================
a || 1.00A, 1.00B, 1.00C, 3 more..
---++-------------------------------
|| 1.00A, 1.00B, 1.00C, 3 more..
# 2. Unless --no-elide is used.
$ hledger -f- bal -Y --no-elide
Balance changes in 2020:
@ -48,16 +38,16 @@ Balance changes in 2020:
ea50865f:3bfb86b7:bf72f75a:a7cad1ac C$ -26.00
ea50865f:325566ed:216fec7e:7b433efb C$ 1.44
# 3. Make sure all amounts up to the largest fit
# 2. Make sure all amounts up to the largest fit
$ hledger -f- bal -Y --color=yes
Balance changes in 2020:
|| 2020
=====================================++=================================
26018c6e:ced6cffd:c3c182f1:7b433efb || $ 9.41, C$ 24.56, 2 more..
ea50865f:325566ed:216fec7e:7b433efb || $ 0.59, C$ 1.44, £ 0.91, € 0.79
ea50865f:325566ed:47134948 || £ 18.25
ea50865f:3bfb86b7:bf72f75a:a7cad1ac || $ -10.00, C$ -26.00, € -10.00
-------------------------------------++---------------------------------
|| 0
|| 2020
=====================================++====================================
26018c6e:ced6cffd:c3c182f1:7b433efb || $ 9.41, C$ 24.56, £ -19.16, € 9.21
ea50865f:325566ed:216fec7e:7b433efb || $ 0.59, C$ 1.44, £ 0.91, € 0.79
ea50865f:325566ed:47134948 || £ 18.25
ea50865f:3bfb86b7:bf72f75a:a7cad1ac || $ -10.00, C$ -26.00, € -10.00
-------------------------------------++------------------------------------
|| 0
>=0