1 {-| 2 3 A ledger-compatible @print@ command. 4 5 -} 6 7 module Hledger.Cli.Print ( 8 print' 9 ,showTransactions 10 ) where 11 import Data.List 12 13 import Hledger 14 import Prelude hiding (putStr) 15 import Hledger.Utils.UTF8 (putStr) 16 import Hledger.Cli.Options 17 18 -- | Print journal transactions in standard format. 19 print' :: CliOpts -> Journal -> IO () 20 print' CliOpts{reportopts_=ropts} j = do 21 d <- getCurrentDay 22 putStr $ showTransactions ropts (optsToFilterSpec ropts d) j 23 24 showTransactions :: ReportOpts -> FilterSpec -> Journal -> String 25 showTransactions opts fspec j = entriesReportAsText opts fspec $ entriesReport opts fspec j 26 27 entriesReportAsText :: ReportOpts -> FilterSpec -> EntriesReport -> String 28 entriesReportAsText opts _ items = concatMap (showTransactionForPrint (effective_ opts)) items 29