hledger-0.14: A robust command-line accounting tool with a simple human-editable data format, similar to ledger.

Hledger.Cli.Options

Description

Command-line options for the application.

Synopsis

Documentation

options_cli :: [OptDescr Opt]Source

The program name which, if we are invoked as (via symlink or renaming), causes us to default to reading the user's time log instead of their journal.

Command-line options we accept.

data Opt Source

An option value from a command-line flag.

Instances

parseArgumentsWith :: [OptDescr Opt] -> IO ([Opt], [String])Source

Parse the command-line arguments into options and arguments using the specified option descriptors. Any smart dates in the options are converted to explicit YYYYMMDD format based on the current time. If parsing fails, raise an error, displaying the problem along with the provided usage string.

fixOptDates :: [Opt] -> IO [Opt]Source

Convert any fuzzy dates within these option values to explicit ones, based on today's date.

dateSpanFromOpts :: Day -> [Opt] -> DateSpanSource

Figure out the overall date span we should report on, based on any beginendperiod options provided. If there is a period option, the others are ignored.

intervalFromOpts :: [Opt] -> IntervalSource

Figure out the reporting interval, if any, specified by the options. If there is a period option, the others are ignored.

depthFromOpts :: [Opt] -> Maybe IntSource

Get the value of the (last) depth option, if any.

dropFromOpts :: [Opt] -> IntSource

Get the value of the (last) drop option, if any, otherwise 0.

displayExprFromOpts :: [Opt] -> Maybe StringSource

Get the value of the (last) display option, if any.

baseUrlFromOpts :: [Opt] -> Maybe StringSource

Get the value of the (last) baseurl option, if any.

portFromOpts :: [Opt] -> Maybe IntSource

Get the value of the (last) port option, if any.

usingTimeProgramName :: IO BoolSource

Get a maybe boolean representing the last cleared/uncleared option if any.

Were we invoked as "hours" ?

journalFilePathFromOpts :: [Opt] -> IO StringSource

Get the journal file path from options, an environment variable, or a default

parsePatternArgs :: [String] -> ([String], [String])Source

Gather filter pattern arguments into a list of account patterns and a list of description patterns. We interpret pattern arguments as follows: those prefixed with desc: are description patterns, all others are account patterns; also patterns prefixed with not: are negated. not: should come after desc: if both are used.

optsToFilterSpec :: [Opt] -> [String] -> LocalTime -> FilterSpecSource

Convert application options to the library's generic filter specification.