hledger-1.9: Command-line interface for the hledger accounting tool

Safe HaskellNone



Utilities for top-level modules and ghci. See also Hledger.Read and Hledger.Utils.



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. If the file exists it will be overwritten.

journalApplyValue :: ReportOpts -> Journal -> IO Journal Source #

If -V/--value was requested, convert all journal amounts to their market value as of the report end date. Cf http://hledger.org/manual.html#market-value Since 2017/4 we do this early, before commands run, which affects all commands and seems to have the same effect as doing it last on the reported values.

journalAddForecast :: CliOpts -> Journal -> IO Journal Source #

Run PeriodicTransactions from journal from today or journal end to requested end day. Add generated transactions to the journal

generateAutomaticPostings :: ReportOpts -> Journal -> Journal Source #

Generate Automatic postings and add them to the current journal.

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.

writeFileWithBackupIfChanged :: FilePath -> Text -> IO Bool Source #

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.

pivotByOpts :: CliOpts -> Journal -> Journal Source #

Apply the pivot transformation on a journal, if option is present.

anonymiseByOpts :: CliOpts -> Journal -> Journal Source #

Apply the anonymisation transformation on a journal, if option is present

data Test :: * #

The basic structure used to create an annotated tree of test cases.


TestList [Test]

A set of Tests sharing the same level in the hierarchy.


Show Test 


showsPrec :: Int -> Test -> ShowS #

show :: Test -> String #

showList :: [Test] -> ShowS #

Testable Test 


test :: Test -> Test #