diff --git a/Account.hs b/Account.hs index cedd5fd59..84363de6f 100644 --- a/Account.hs +++ b/Account.hs @@ -108,9 +108,8 @@ ledgerAccountTreeMatching l showsubs [] = ledgerAccountTreeMatching l showsubs [".*"] ledgerAccountTreeMatching l showsubs acctpats = addDataToAccountNameTree l $ - filterAccountNameTree acctpat $ + filterAccountNameTree acctpats $ ledgerAccountNameTree l - where acctpat = head acctpats showLedgerAccounts :: Ledger -> Bool -> [String] -> String showLedgerAccounts l showsubs acctpats = diff --git a/AccountName.hs b/AccountName.hs index 546a926ff..0527d7779 100644 --- a/AccountName.hs +++ b/AccountName.hs @@ -82,7 +82,10 @@ showAccountNameTree t = where topacct = indentAccountName 0 $ root t -filterAccountNameTree :: String -> Tree AccountName -> Tree AccountName -filterAccountNameTree s = treefilter ((matchAccountName s) . accountLeafName) ---any (flip matchAccountName . accountLeafName) acctpats +filterAccountNameTree :: [String] -> Tree AccountName -> Tree AccountName +filterAccountNameTree pats = + treefilter matchany + where + matchany a = any (match a) pats + match a pat = matchAccountName pat $ accountLeafName a diff --git a/TODO b/TODO index f5d63b1d4..74ea48b87 100644 --- a/TODO +++ b/TODO @@ -75,9 +75,8 @@ algorithm: 2 add subaccounts if -s 3 display account tree, eliding boring accounts -* include subaccounts +include subaccounts elide boring accounts -handle multiple patterns