From 2c18614e7b0b97aacd7e12ac3d82fa688e6b2a6f Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 11 Sep 2025 09:58:02 +0100 Subject: [PATCH] ;dev: journalTransform notes --- hledger/Hledger/Cli/Commands/Run.hs | 4 ++-- hledger/Hledger/Cli/Utils.hs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hledger/Hledger/Cli/Commands/Run.hs b/hledger/Hledger/Cli/Commands/Run.hs index d55c68aa0..8ba28036b 100644 --- a/hledger/Hledger/Cli/Commands/Run.hs +++ b/hledger/Hledger/Cli/Commands/Run.hs @@ -218,8 +218,8 @@ journalFilePathFromOptsOrDefault defaultJournalOverride cliopts = do Nothing -> return defaultFiles -- use the journal(s) given to the "run" itself Just journalpaths -> return journalpaths --- | Similar to `withJournal`, but uses caches all the journals it reads. --- When reading from stdin, caches the stdin contents so that we could reprocess +-- | Similar to `withJournal`, but caches all the journals it reads. +-- When reading from stdin, also caches the stdin contents so that we could reprocess -- it if a read with different InputOptions is requested. withJournalCached :: Maybe DefaultRunJournal -> CliOpts -> ((Journal, DefaultRunJournal) -> IO ()) -> IO () withJournalCached defaultJournalOverride cliopts cmd = do diff --git a/hledger/Hledger/Cli/Utils.hs b/hledger/Hledger/Cli/Utils.hs index 0bef6d90e..a9b96746c 100644 --- a/hledger/Hledger/Cli/Utils.hs +++ b/hledger/Hledger/Cli/Utils.hs @@ -89,6 +89,8 @@ journalTransform opts = pivotByOpts opts <&> anonymiseByOpts opts <&> maybeObfuscate opts +-- XXX Called by withJournalDo, journalReload, uiReloadJournal, withJournalCached. +-- Could it be moved down into journalFinalise ? These steps only depend on InputOpts. -- | Apply the pivot transformation on a journal (replacing account names by a different field's value), if option is present. pivotByOpts :: CliOpts -> Journal -> Journal