From b47d582583187260488612c2a1fddbe5a5db4234 Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Wed, 30 Dec 2020 21:19:11 +0100 Subject: [PATCH] ;check: fixes --- hledger-lib/Hledger/Data/Types.hs | 2 +- hledger-lib/Hledger/Read/Common.hs | 2 +- hledger/Hledger/Cli/Commands/Check.hs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hledger-lib/Hledger/Data/Types.hs b/hledger-lib/Hledger/Data/Types.hs index 48f0d5278..c9ec78519 100644 --- a/hledger-lib/Hledger/Data/Types.hs +++ b/hledger-lib/Hledger/Data/Types.hs @@ -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 diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index 5ec5a8c13..4c822f883 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -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 diff --git a/hledger/Hledger/Cli/Commands/Check.hs b/hledger/Hledger/Cli/Commands/Check.hs index d31f26f91..7ba349183 100644 --- a/hledger/Hledger/Cli/Commands/Check.hs +++ b/hledger/Hledger/Cli/Commands/Check.hs @@ -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).