lib: when reloading a journal, keep aliases and pivot in effect
This commit is contained in:
parent
8b9f5e1cdf
commit
4927711490
@ -62,8 +62,8 @@ import Hledger.Read
|
|||||||
import Hledger.Utils
|
import Hledger.Utils
|
||||||
|
|
||||||
|
|
||||||
-- | Parse the user's specified journal file and run a hledger command on
|
-- | Parse the user's specified journal file, maybe apply some transformations
|
||||||
-- it, or throw an error.
|
-- (aliases, pivot) and run a hledger command on it, or throw an error.
|
||||||
withJournalDo :: CliOpts -> (CliOpts -> Journal -> IO ()) -> IO ()
|
withJournalDo :: CliOpts -> (CliOpts -> Journal -> IO ()) -> IO ()
|
||||||
withJournalDo opts cmd = do
|
withJournalDo opts cmd = do
|
||||||
-- We kludgily read the file before parsing to grab the full text, unless
|
-- We kludgily read the file before parsing to grab the full text, unless
|
||||||
@ -101,12 +101,14 @@ writeOutput opts s = do
|
|||||||
-- readJournalWithOpts :: CliOpts -> String -> IO Journal
|
-- readJournalWithOpts :: CliOpts -> String -> IO Journal
|
||||||
-- readJournalWithOpts opts s = readJournal Nothing Nothing Nothing s >>= either error' return
|
-- readJournalWithOpts opts s = readJournal Nothing Nothing Nothing s >>= either error' return
|
||||||
|
|
||||||
-- | Re-read the journal file(s) specified by options, or return an error string.
|
-- | Re-read the journal file(s) specified by options and maybe apply some
|
||||||
|
-- transformations (aliases, pivot), or return an error string.
|
||||||
-- Reads the full journal, without filtering.
|
-- Reads the full journal, without filtering.
|
||||||
journalReload :: CliOpts -> IO (Either String Journal)
|
journalReload :: CliOpts -> IO (Either String Journal)
|
||||||
journalReload opts = do
|
journalReload opts = do
|
||||||
rulespath <- rulesFilePathFromOpts opts
|
rulespath <- rulesFilePathFromOpts opts
|
||||||
journalpaths <- journalFilePathFromOpts opts
|
journalpaths <- journalFilePathFromOpts opts
|
||||||
|
((pivotByOpts opts . journalApplyAliases (aliasesFromOpts opts)) <$>) <$>
|
||||||
readJournalFiles Nothing rulespath (not $ ignore_assertions_ opts) journalpaths
|
readJournalFiles Nothing rulespath (not $ ignore_assertions_ opts) journalpaths
|
||||||
|
|
||||||
-- | Re-read the option-specified journal file(s), but only if any of
|
-- | Re-read the option-specified journal file(s), but only if any of
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user