Copyright | (c) Frederick Pringle 2023 |
---|---|
License | BSD-3-Clause |
Maintainer | freddyjepringle@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
Hoyo.Config
Description
Configuration for the hoyo program. This is stored on-disk as a TOML file, usually at ~.confighoyo/config.toml
Synopsis
- data Config = Config {
- _failOnError :: !(ConfigValue 'TBool)
- _displayCreationTime :: !(ConfigValue 'TBool)
- _enableClearing :: !(ConfigValue 'TBool)
- _enableReset :: !(ConfigValue 'TBool)
- _backupBeforeClear :: !(ConfigValue 'TBool)
- _defaultBookmarks :: !(ConfigValue ('TList 'TDefaultBookmark))
- _defaultCommand :: !(ConfigValue ('TMaybe 'TCommand))
- defaultConfig :: Config
- decodeConfig :: Text -> Either HoyoException Config
- decodeConfigFile :: (MonadIO m, MonadCatch m) => FilePath -> m (Either HoyoException Config)
- encodeConfig :: Config -> Text
- encodeConfigFile :: (MonadIO m, MonadCatch m) => FilePath -> Config -> m (Either HoyoException ())
- setConfig :: MonadError HoyoException m => Text -> Text -> Config -> m Config
- getKeyVals :: Config -> [(Text, AnyConfigValue)]
Documentation
A representation of hoyo settings.
Constructors
Config | |
Fields
|
defaultConfig :: Config Source #
The default config for hoyo.
decodeConfig :: Text -> Either HoyoException Config Source #
Decode a Config
from a Text.
decodeConfigFile :: (MonadIO m, MonadCatch m) => FilePath -> m (Either HoyoException Config) Source #
Decode a Config
from a file.
encodeConfigFile :: (MonadIO m, MonadCatch m) => FilePath -> Config -> m (Either HoyoException ()) Source #
Encode a Config
to a file.
setConfig :: MonadError HoyoException m => Text -> Text -> Config -> m Config Source #
Try to set a key-value pair in the config.
getKeyVals :: Config -> [(Text, AnyConfigValue)] Source #
Get TOML key-value pairs from a Config
.