diff --git a/hledger/Hledger/Cli/Commands/Balance.hs b/hledger/Hledger/Cli/Commands/Balance.hs index 215adc004..b29c7699b 100644 --- a/hledger/Hledger/Cli/Commands/Balance.hs +++ b/hledger/Hledger/Cli/Commands/Balance.hs @@ -476,7 +476,7 @@ multiBalanceReportAsCsv opts@ReportOpts{average_, row_total_} ++ ["total" | row_total_] ++ ["average" | average_] ) : - [displayName a : + [accountNameDrop (drop_ opts) (displayFull a) : map (wbToText . showMixedAmountB (balanceOpts False opts)) (amts ++ [rowtot | row_total_] diff --git a/hledger/test/balance/drop.test b/hledger/test/balance/drop.test index 283dbc092..de1e355c8 100644 --- a/hledger/test/balance/drop.test +++ b/hledger/test/balance/drop.test @@ -41,3 +41,13 @@ $ hledger -f - balance --tree --no-total --drop 1 1 q 1 ... >= + +# 4. Drop works with csv output in tree mode +$ hledger -f - balance --tree --no-total --output-format=csv --drop 1 +"account","balance" +"k","1" +"i:p","1" +"j","2" +"j:q","1" +"...","1" +>= diff --git a/hledger/test/balancesheet.test b/hledger/test/balancesheet.test index ef1bf0c93..2e6e2618f 100644 --- a/hledger/test/balancesheet.test +++ b/hledger/test/balancesheet.test @@ -305,3 +305,25 @@ Balance Sheet 2020-03-25 || =============++============ Net: || $1 + +# 12. Check csv output (for tree mode) (#1566) +$ hledger -f - balancesheet --tree --output-format=csv +"Balance Sheet 2020-03-25","" +"Account","2020-03-25" +"Assets","" +"assets:a","$1" +"total","$1" +"Liabilities","" +"total" +"Net:","$1" + +# 13. Check csv output (for tree mode) with dropping +$ hledger -f - balancesheet --tree --output-format=csv --drop 1 +"Balance Sheet 2020-03-25","" +"Account","2020-03-25" +"Assets","" +"a","$1" +"total","$1" +"Liabilities","" +"total" +"Net:","$1"