diff --git a/hledger/Hledger/Cli/Balance.hs b/hledger/Hledger/Cli/Balance.hs index 320713dd4..7f1ed0d07 100644 --- a/hledger/Hledger/Cli/Balance.hs +++ b/hledger/Hledger/Cli/Balance.hs @@ -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 diff --git a/hledger/Hledger/Cli/Options.hs b/hledger/Hledger/Cli/Options.hs index 3765a5fe1..109aec333 100644 --- a/hledger/Hledger/Cli/Options.hs +++ b/hledger/Hledger/Cli/Options.hs @@ -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}