hledger-1.52.1: Command-line interface for the hledger accounting system

Safe Haskell | None
Language | GHC2021

Hledger.Cli.Conf

Description

Read extra CLI arguments from a hledger config file.

Synopsis

- data Conf
- type SectionName = String
- getConf :: RawOpts -> IO (Either String (Conf, Maybe FilePath))
- getConf' :: RawOpts -> IO (Conf, Maybe FilePath)
- nullconf :: Conf
- confLookup :: SectionName -> Conf -> [Arg]
- activeConfFile :: IO (Maybe FilePath)
- activeLocalConfFile :: IO (Maybe FilePath)
- activeUserConfFile :: IO (Maybe FilePath)
- confFiles :: IO [FilePath]
- userConfFiles :: IO [FilePath]
- parseConf :: FilePath -> Text -> Either (ParseErrorBundle Text HledgerParseErrorData) [ConfSection]

# Documentation

data Conf Source #

A hledger config file.

#### Instances

Instances details

Show Conf Source # |
Instance details Defined in Hledger.Cli.Conf Methods showsPrec :: Int -> Conf -> ShowS Source # show :: Conf -> String Source # showList :: [Conf] -> ShowS Source #
Eq Conf Source # |
Instance details Defined in Hledger.Cli.Conf Methods (==) :: Conf -> Conf -> Bool Source # (/=) :: Conf -> Conf -> Bool Source #

type SectionName = String Source #

The name of a config file section, with surrounding brackets and whitespace removed.

getConf :: RawOpts -> IO (Either String (Conf, Maybe FilePath)) Source #

Try to read a hledger config from a config file specified by --conf, or the first config file found in any of several default file paths. If --no-conf was used, or if no file was specified or found, this returns a null Conf. If a specified file, or the first file found, can not be read or parsed, this returns an error message. Otherwise this returns the parsed Conf, and the file path.

getConf' :: RawOpts -> IO (Conf, Maybe FilePath) Source #

Like getConf but throws an error on failure.

nullconf :: Conf Source #

confLookup :: SectionName -> Conf -> [Arg] Source #

Fetch all the arguments/options defined in a section with this name, if it exists. This should be "general" for the unnamed first section, or a hledger command name.

activeConfFile :: IO (Maybe FilePath) Source #

Get the highest precedence config file, based on the current directory.

activeLocalConfFile :: IO (Maybe FilePath) Source #

Get the highest precedence local config file: a config file in the current directory or above, that is not a user-wide config file.

activeUserConfFile :: IO (Maybe FilePath) Source #

Get the highest precedence user-wide config file, based on the current directory. (This may not be the active config file.)

confFiles :: IO [FilePath] Source #

Get the possibleConfFiles which exist, based on the current directory.

userConfFiles :: IO [FilePath] Source #

Get the possibleUserConfFiles which exist, based on the current directory.

parseConf :: FilePath -> Text -> Either (ParseErrorBundle Text HledgerParseErrorData) [ConfSection] Source #