From 3b34987bdd12c4c2a6b4f13c32d26acca0923ee5 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 4 Aug 2022 19:01:11 +0100 Subject: [PATCH] dev: accounts: clarifications --- hledger/Hledger/Cli/Commands/Accounts.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hledger/Hledger/Cli/Commands/Accounts.hs b/hledger/Hledger/Cli/Commands/Accounts.hs index 56b87a2d4..fdf233a3e 100644 --- a/hledger/Hledger/Cli/Commands/Accounts.hs +++ b/hledger/Hledger/Cli/Commands/Accounts.hs @@ -63,12 +63,13 @@ accounts CliOpts{rawopts_=rawopts, reportspec_=ReportSpec{_rsQuery=query,_rsRepo filter (matchesAccountExtra (journalAccountType j) (journalInheritedAccountTags j) nodepthq) $ map fst $ jdeclaredaccounts j matchedusedaccts = dbg5 "matchedusedaccts" $ map paccount $ journalPostings $ filterJournalPostings nodepthq j - accts = dbg5 "accts to show" $ -- no need to nub/sort, accountTree will + accts = dbg5 "accts to show" $ if | declared && not used -> matcheddeclaredaccts | not declared && used -> matchedusedaccts | otherwise -> matcheddeclaredaccts ++ matchedusedaccts - -- 2. sort them by declaration order and name, at each level of their tree structure + -- 2. sort them by declaration order (then undeclared accounts alphabetically) + -- within each group of siblings sortedaccts = sortAccountNamesByDeclaration j tree accts -- 3. if there's a depth limit, depth-clip and remove any no longer useful items