From 4a399e50cbd4877734578f73b9eb802dde679896 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 13 Oct 2018 13:22:11 -0700 Subject: [PATCH] acc: don't require an explicit --flat to make --drop work --- hledger-lib/Hledger/Reports/BudgetReport.hs | 1 + hledger/Hledger/Cli/Commands/Accounts.hs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hledger-lib/Hledger/Reports/BudgetReport.hs b/hledger-lib/Hledger/Reports/BudgetReport.hs index b123ddeb6..12dd3d09f 100644 --- a/hledger-lib/Hledger/Reports/BudgetReport.hs +++ b/hledger-lib/Hledger/Reports/BudgetReport.hs @@ -341,6 +341,7 @@ budgetReportAsTable )) -- XXX here for now +-- TODO: does not work for flat-by-default reports with --flat not specified explicitly -- | Drop leading components of accounts names as specified by --drop, but only in --flat mode. maybeAccountNameDrop :: ReportOpts -> AccountName -> AccountName maybeAccountNameDrop opts a | flat_ opts = accountNameDrop (drop_ opts) a diff --git a/hledger/Hledger/Cli/Commands/Accounts.hs b/hledger/Hledger/Cli/Commands/Accounts.hs index 49ee47b4e..61087b5a4 100644 --- a/hledger/Hledger/Cli/Commands/Accounts.hs +++ b/hledger/Hledger/Cli/Commands/Accounts.hs @@ -98,5 +98,5 @@ accounts CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do where render a | tree_ ropts = T.replicate (2 * (accountNameLevel a - 1)) " " <> accountLeafName a - | otherwise = maybeAccountNameDrop ropts a + | otherwise = accountNameDrop (drop_ ropts) a