From dd202d31130fc28dffc0c3a3fe4117331f31f848 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 10 Mar 2007 22:03:48 +0000 Subject: [PATCH] handle multiple account patterns for balance report --- Account.hs | 3 +-- AccountName.hs | 9 ++++++--- TODO | 3 +-- 3 files changed, 8 insertions(+), 7 deletions(-) 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