Command-line options for the hledger program, and option-parsing utilities.
- type RawOpts = [(String, String)]
- defmode :: Mode RawOpts
- data CliOpts = CliOpts {
- rawopts_ :: RawOpts
- command_ :: String
- file_ :: Maybe FilePath
- alias_ :: [String]
- debug_ :: Bool
- no_new_accounts_ :: Bool
- rules_file_ :: Maybe FilePath
- reportopts_ :: ReportOpts
- toCliOpts :: RawOpts -> IO CliOpts
- getHledgerCliOpts :: [String] -> IO CliOpts
- getHledgerAddonCommands :: IO [String]
- getHledgerProgramsInPath :: IO [String]
- in_ :: String -> RawOpts -> Bool
- maybeintopt :: String -> RawOpts -> Maybe Int
- maybesmartdateopt :: Day -> String -> RawOpts -> Maybe Day
- maybedisplayopt :: Day -> RawOpts -> Maybe DisplayExp
- maybeperiodopt :: Day -> RawOpts -> Maybe (Interval, DateSpan)
- checkCliOpts :: CliOpts -> IO CliOpts
- formatFromOpts :: ReportOpts -> Either String [FormatString]
- defaultBalanceFormatString :: [FormatString]
- journalFilePathFromOpts :: CliOpts -> IO String
- aliasesFromOpts :: CliOpts -> [(AccountName, AccountName)]
Documentation
CliOpts | |
|
toCliOpts :: RawOpts -> IO CliOptsSource
Parse raw option string values to the desired final data types. Any relative smart dates will be converted to fixed dates based on today's date. Parsing failures will raise an error.
getHledgerCliOpts :: [String] -> IO CliOptsSource
Get all command-line options, specifying any extra commands that are allowed, or fail on parse errors.
getHledgerAddonCommands :: IO [String]Source
Get the unique suffixes (without hledger-) of hledger-* executables found in the current user's PATH, or the empty list if there is any problem.
getHledgerProgramsInPath :: IO [String]Source
Get the unique names of hledger-* executables found in the current user's PATH, or the empty list if there is any problem.
in_ :: String -> RawOpts -> BoolSource
Convert possibly encoded option values to regular unicode strings.
maybedisplayopt :: Day -> RawOpts -> Maybe DisplayExpSource
checkCliOpts :: CliOpts -> IO CliOptsSource
Do final validation of processed opts, raising an error if there is trouble.
formatFromOpts :: ReportOpts -> Either String [FormatString]Source
Parse any format option provided, possibly raising an error, or get the default value.
defaultBalanceFormatString :: [FormatString]Source
Default line format for balance report: %20(total) %2(depth_spacer)%-(account)
journalFilePathFromOpts :: CliOpts -> IO StringSource
Get the journal file path from options, an environment variable, or a default
aliasesFromOpts :: CliOpts -> [(AccountName, AccountName)]Source