hledger
Safe HaskellNone
LanguageGHC2021

Hledger.Cli.Commands.Add

Description

A history-aware, tab-completing interactive add command to help with data entry.

Synopsis

Documentation

add :: CliOpts -> Journal -> IO () Source #

Read multiple transactions from the console, prompting for each field, and append them to the journal file. If the journal came from stdin, this command has no effect.

appendToJournalFileOrStdout :: FilePath -> Text -> IO () Source #

Append a string, typically one or more transactions, to a journal file, or if the file is "-", dump it to stdout. Tries to avoid adding excess whitespace. Also, this also does a quick append test before the actual append, to avoid data loss in case of filesystems with broken append (see ensureFilesystemCanAppend).

XXX This writes unix line endings (n), some at least, even if the file uses dos line endings (rn), which could leave mixed line endings in the file. See also writeFileWithBackupIfChanged.

journalAddTransaction :: Journal -> CliOpts -> Transaction -> IO Journal Source #

Append this transaction to the journal's file and transaction list.

journalFileTextAfterAppends :: FilePath -> [Text] -> IO Text Source #

The whole text a journal file will have after appendToJournalFileOrStdout appends each of these texts to it: its current text (none if it doesn't exist yet), then the appended texts. Useful for checking appends before doing them (see journalCheckChange).