Utilities for top-level modules and ghci. See also Hledger.Read and Hledger.Utils.
- withJournalDo :: CliOpts -> (CliOpts -> Journal -> IO ()) -> IO ()
- writeOutput :: CliOpts -> String -> IO ()
- journalReload :: CliOpts -> IO (Either String Journal)
- journalReloadIfChanged :: CliOpts -> Day -> Journal -> IO (Either String Journal, Bool)
- journalFileIsNewer :: Journal -> IO Bool
- journalSpecifiedFileIsNewer :: Journal -> FilePath -> IO Bool
- fileModificationTime :: FilePath -> IO ClockTime
- openBrowserOn :: String -> IO ExitCode
- writeFileWithBackup :: FilePath -> String -> IO ()
- writeFileWithBackupIfChanged :: FilePath -> Text -> IO Bool
- readFileStrictly :: FilePath -> IO Text
- data Test :: * = TestList [Test]
Parse the user's specified journal file, maybe apply some transformations (aliases, pivot) and run a hledger command on it, or throw an error.
Write some output to stdout or to a file selected by --output-file.
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.
Re-read the option-specified journal file(s), but only if any of them has changed since last read. (If the file is standard input, this will either do nothing or give an error, not tested yet). Returns a journal or error message, and a flag indicating whether it was re-read or not. Like withJournalDo and journalReload, reads the full journal, without filtering.
Has the journal's main data file changed since the journal was last read ?
Has the specified file (presumably one of journal's data files) changed since journal was last read ?
Get the last modified time of the specified file, or if it does not exist or there is some other error, the current time.
Attempt to open a web browser on the given url, all platforms.
Back up this file with a (incrementing) numbered suffix, then overwrite it with this new text, or give an error.
Back up this file with a (incrementing) numbered suffix then overwrite it with this new text, or give an error, but only if the text is different from the current file contents, and return a flag indicating whether we did anything.