balance: --no-elide prevents collapsing of boring accounts to line
This commit is contained in:
parent
8d0b42e1d5
commit
58a50c2ff1
@ -201,7 +201,8 @@ balanceReport :: [Opt] -> FilterSpec -> Journal -> BalanceReport
|
||||
balanceReport opts filterspec j = (items, total)
|
||||
where
|
||||
items = map mkitem interestingaccts
|
||||
interestingaccts = filter (isInteresting opts l) acctnames
|
||||
interestingaccts | NoElide `elem` opts = acctnames
|
||||
| otherwise = filter (isInteresting opts l) acctnames
|
||||
acctnames = sort $ tail $ flatten $ treemap aname accttree
|
||||
accttree = ledgerAccountTree (fromMaybe 99999 $ depthFromOpts opts) l
|
||||
total = sum $ map abalance $ ledgerTopAccounts l
|
||||
@ -254,6 +255,7 @@ exclusiveBalance :: Account -> MixedAmount
|
||||
exclusiveBalance = sumPostings . apostings
|
||||
|
||||
-- | Is the named account considered interesting for this ledger's balance report ?
|
||||
-- We follow the style of ledger's balance command.
|
||||
isInteresting :: [Opt] -> Ledger -> AccountName -> Bool
|
||||
isInteresting opts l a | Flat `elem` opts = isInterestingFlat opts l a
|
||||
| otherwise = isInterestingIndented opts l a
|
||||
|
||||
@ -74,6 +74,7 @@ options_cli = [
|
||||
"EXPR is 'dOP[DATE]' and OP is <, <=, =, >=, >)")
|
||||
,Option "" ["effective"] (NoArg Effective) "use transactions' effective dates, if any"
|
||||
,Option "E" ["empty"] (NoArg Empty) "show empty/zero things which are normally elided"
|
||||
,Option "" ["no-elide"] (NoArg NoElide) "no eliding at all, stronger than -E (eg for balance report)"
|
||||
,Option "R" ["real"] (NoArg Real) "report only on real (non-virtual) transactions"
|
||||
,Option "" ["flat"] (NoArg Flat) "balance: show full account names, unindented"
|
||||
,Option "" ["drop"] (ReqArg Drop "N") "balance: with --flat, elide first N account name components"
|
||||
@ -108,6 +109,7 @@ data Opt =
|
||||
| Display {value::String}
|
||||
| Effective
|
||||
| Empty
|
||||
| NoElide
|
||||
| Real
|
||||
| Flat
|
||||
| Drop {value::String}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user