;check: fixes

This commit is contained in:
Damien Cassou 2020-12-30 21:19:11 +01:00 committed by Simon Michael
parent de56d09024
commit b47d582583
3 changed files with 4 additions and 4 deletions

View File

@ -455,7 +455,7 @@ data Journal = Journal {
,jparsetimeclockentries :: [TimeclockEntry] -- ^ timeclock sessions which have not been clocked out
,jincludefilestack :: [FilePath]
-- principal data
,jdeclaredpayees :: [(Payee,PayeeDeclarationInfo)] -- ^ Accounts declared by account directives, in parse order (after journal finalisation)
,jdeclaredpayees :: [(Payee,PayeeDeclarationInfo)] -- ^ Payees declared by payee directives, in parse order (after journal finalisation)
,jdeclaredaccounts :: [(AccountName,AccountDeclarationInfo)] -- ^ Accounts declared by account directives, in parse order (after journal finalisation)
,jdeclaredaccounttypes :: M.Map AccountType [AccountName] -- ^ Accounts whose type has been declared in account directives (usually 5 top-level accounts)
,jglobalcommoditystyles :: M.Map CommoditySymbol AmountStyle -- ^ per-commodity display styles declared globally, eg by command line option or import command

View File

@ -376,7 +376,7 @@ journalCheckPayeesDeclared j = sequence_ $ map checkpayee $ jtxns j
where
checkpayee t
| p `elem` ps = Right ()
| otherwise =
| otherwise =
Left $ "\nundeclared payee \""++T.unpack p++"\""
++ "\nin transaction at: "++showGenericSourcePos (tsourcepos t)
where

View File

@ -18,7 +18,7 @@ import Data.Either (partitionEithers)
import Data.Char (toUpper)
import Safe (readMay)
import Control.Monad (forM_)
import System.IO (stderr, hPutStr)
import System.IO (stderr, hPutStrLn)
import System.Exit (exitFailure)
checkmode :: Mode RawOpts
@ -79,7 +79,7 @@ runCheck copts@CliOpts{rawopts_} j (check,args) =
Payees ->
case journalCheckPayeesDeclared j of
Right () -> return ()
Left err -> hPutStr stderr err >> exitFailure
Left err -> hPutStrLn stderr err >> exitFailure
where
-- Hack: append the provided args to the raw opts,
-- in case the check can use them (like checkdates --unique).