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