mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-30 22:02:20 +03:00
use shakespeare-text to help lay out incomestatement's output
This commit is contained in:
parent
a27eb7c29f
commit
abb470aadb
@ -66,6 +66,7 @@ library
|
||||
,parsec
|
||||
,regexpr >= 0.5.1
|
||||
,safe >= 0.2
|
||||
,shakespeare-text >= 1.0 && < 1.1
|
||||
,split == 0.1.*
|
||||
,time
|
||||
,utf8-string >= 0.3.5 && < 0.4
|
||||
|
@ -1,3 +1,4 @@
|
||||
{-# LANGUAGE QuasiQuotes, TemplateHaskell, OverloadedStrings #-}
|
||||
{-|
|
||||
|
||||
The @incomestatement@ command prints a fairly standard income statement (profit & loss) report.
|
||||
@ -9,24 +10,23 @@ module Hledger.Cli.Incomestatement (
|
||||
,tests_Hledger_Cli_Incomestatement
|
||||
) where
|
||||
|
||||
import Data.List
|
||||
import qualified Data.Text.Lazy.IO as LT
|
||||
import Test.HUnit
|
||||
import Text.Shakespeare.Text
|
||||
|
||||
import Hledger
|
||||
import Prelude hiding (putStr)
|
||||
import Hledger.Utils.UTF8IOCompat (putStr)
|
||||
import Hledger.Cli.Options
|
||||
import Hledger.Cli.Balance
|
||||
|
||||
|
||||
-- | Print a standard income statement.
|
||||
incomestatement :: CliOpts -> Journal -> IO ()
|
||||
incomestatement CliOpts{reportopts_=ropts} j = do
|
||||
let lines = case formatFromOpts ropts of
|
||||
Left err -> [err]
|
||||
Right _ -> accountsReportAsText ropts $ accountsReport2 ropts (journalProfitAndLossAccountQuery j) j
|
||||
putStr $ unlines lines
|
||||
let report = accountsReport2 ropts (journalProfitAndLossAccountQuery j) j
|
||||
LT.putStr $ [lt|Income Statement
|
||||
|
||||
#{unlines $ accountsReportAsText ropts report}|]
|
||||
|
||||
tests_Hledger_Cli_Incomestatement :: Test
|
||||
tests_Hledger_Cli_Incomestatement = TestList
|
||||
[
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user