handle multiple account patterns for balance report

This commit is contained in:
Simon Michael 2007-03-10 22:03:48 +00:00
parent 1e1c819f4e
commit dd202d3113
3 changed files with 8 additions and 7 deletions

View File

@ -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 =

View File

@ -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

3
TODO
View File

@ -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