Safe Haskell | None |
---|---|
Language | Haskell2010 |
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]
Documentation
withJournalDo :: CliOpts -> (CliOpts -> Journal -> IO ()) -> IO () Source #
Parse the user's specified journal file, maybe apply some transformations (aliases, pivot) and run a hledger command on it, or throw an error.
writeOutput :: CliOpts -> String -> IO () Source #
Write some output to stdout or to a file selected by --output-file.
journalReload :: CliOpts -> IO (Either String Journal) Source #
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.
journalReloadIfChanged :: CliOpts -> Day -> Journal -> IO (Either String Journal, Bool) Source #
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.
journalFileIsNewer :: Journal -> IO Bool Source #
Has the journal's main data file changed since the journal was last read ?
journalSpecifiedFileIsNewer :: Journal -> FilePath -> IO Bool Source #
Has the specified file (presumably one of journal's data files) changed since journal was last read ?
fileModificationTime :: FilePath -> IO ClockTime Source #
Get the last modified time of the specified file, or if it does not exist or there is some other error, the current time.
openBrowserOn :: String -> IO ExitCode Source #
Attempt to open a web browser on the given url, all platforms.
writeFileWithBackup :: FilePath -> String -> IO () Source #
Back up this file with a (incrementing) numbered suffix, then overwrite it with this new text, or give an error.