hledger/PrintCommand.hs

22 lines
523 B
Haskell
Raw Normal View History

{-|
A ledger-compatible @print@ command.
-}
module PrintCommand
where
import Ledger
import Options
-- | Print ledger entries in standard format.
2008-10-12 13:17:21 +04:00
print' :: [Opt] -> [String] -> Ledger -> IO ()
print' opts args l = putStr $ showEntries opts args l
showEntries :: [Opt] -> [String] -> Ledger -> String
2008-11-22 09:35:10 +03:00
showEntries opts args l = concatMap showEntry $ filteredentries
where
filteredentries = entries $ filterRawLedgerEntriesByAccount apats $ rawledger l
(apats,_) = parseAccountDescriptionArgs opts args