hledger-lib-0.26: Core data types, parsers and utilities for the hledger accounting tool.

Safe Haskell | None
Language | Haskell2010

Hledger.Data.RawOptions

Description

hledger's cmdargs modes parse command-line arguments to an intermediate format, RawOpts (an association list), rather than a fixed ADT like CliOpts. This allows the modes and flags to be reused more easily by hledger commands/scripts in this and other packages.

Synopsis

- type RawOpts = [(String, String)]
- setopt :: String -> String -> RawOpts -> RawOpts
- setboolopt :: String -> RawOpts -> RawOpts
- inRawOpts :: String -> RawOpts -> Bool
- boolopt :: String -> RawOpts -> Bool
- stringopt :: String -> RawOpts -> String
- maybestringopt :: String -> RawOpts -> Maybe String
- listofstringopt :: String -> RawOpts -> [String]
- intopt :: String -> RawOpts -> Int
- maybeintopt :: String -> RawOpts -> Maybe Int
- optserror :: String -> a

# Documentation

type RawOpts = [(String, String)] Source

The result of running cmdargs: an association list of option names to string values.

setopt :: String -> String -> RawOpts -> RawOpts Source

setboolopt :: String -> RawOpts -> RawOpts Source

inRawOpts :: String -> RawOpts -> Bool Source

Is the named option present ?

boolopt :: String -> RawOpts -> Bool Source

stringopt :: String -> RawOpts -> String Source

maybestringopt :: String -> RawOpts -> Maybe String Source

listofstringopt :: String -> RawOpts -> [String] Source

intopt :: String -> RawOpts -> Int Source

maybeintopt :: String -> RawOpts -> Maybe Int Source

optserror :: String -> a Source

Raise an error, showing the specified message plus a hint about --help.