From 874771d47cd197c219526c3f22f359c01e222f23 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 6 Mar 2025 05:13:37 -1000 Subject: [PATCH] dev:readJournal: assume default file name "-" rather than "(string)" [#2328] "-" implies data from standard input so "string" is perhaps more correct, but I think this is a harmless simplification and it makes `files` output consistent when run by `run`. --- hledger-lib/Hledger/Data/Types.hs | 2 +- hledger-lib/Hledger/Read.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hledger-lib/Hledger/Data/Types.hs b/hledger-lib/Hledger/Data/Types.hs index 4bdae7099..22a794e39 100644 --- a/hledger-lib/Hledger/Data/Types.hs +++ b/hledger-lib/Hledger/Data/Types.hs @@ -651,7 +651,7 @@ data Journal = Journal { -- any included journal files. The main file is first, -- followed by any included files in the order encountered. -- TODO: FilePath is a sloppy type here, don't assume it's a - -- real file; values like "", "-", "(string)" can be seen + -- real file; values like "" or "-" can be seen ,jlastreadtime :: POSIXTime -- ^ when this journal was last read from its file(s) -- NOTE: after adding new fields, eg involving account names, consider updating -- the Anon instance in Hleger.Cli.Anon diff --git a/hledger-lib/Hledger/Read.hs b/hledger-lib/Hledger/Read.hs index d89296791..4390d421e 100644 --- a/hledger-lib/Hledger/Read.hs +++ b/hledger-lib/Hledger/Read.hs @@ -224,7 +224,7 @@ readJournal :: InputOpts -> Maybe FilePath -> Handle -> ExceptT String IO Journa readJournal iopts@InputOpts{strict_, _defer} mpath hdl = do let r :: Reader IO = fromMaybe JournalReader.reader $ findReader (mformat_ iopts) mpath dbg6IO "readJournal: trying reader" (rFormat r) - j <- rReadFn r iopts (fromMaybe "(string)" mpath) hdl + j <- rReadFn r iopts (fromMaybe "-" mpath) hdl when (strict_ && not _defer) $ liftEither $ journalStrictChecks j return j