Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Represents a git configuration.
Synopsis
- newtype Config = Config (ManagedPtr Config)
- class (GObject o, IsDescendantOf Config o) => IsConfig o
- toConfig :: (MonadIO m, IsConfig o) => o -> m Config
- configAddFile :: (HasCallStack, MonadIO m, IsConfig a, IsFile b) => a -> b -> ConfigLevel -> Bool -> m ()
- configDeleteEntry :: (HasCallStack, MonadIO m, IsConfig a) => a -> Text -> m ()
- configFindGlobal :: (HasCallStack, MonadIO m) => m File
- configFindSystem :: (HasCallStack, MonadIO m) => m File
- configForeach :: (HasCallStack, MonadIO m, IsConfig a) => a -> ConfigCallback -> m ()
- configGetBool :: (HasCallStack, MonadIO m, IsConfig a) => a -> Text -> m ()
- configGetEntry :: (HasCallStack, MonadIO m, IsConfig a) => a -> Text -> m ConfigEntry
- configGetInt32 :: (HasCallStack, MonadIO m, IsConfig a) => a -> Text -> m Int32
- configGetInt64 :: (HasCallStack, MonadIO m, IsConfig a) => a -> Text -> m Int64
- configGetString :: (HasCallStack, MonadIO m, IsConfig a) => a -> Text -> m (Maybe Text)
- configMatch :: (HasCallStack, MonadIO m, IsConfig a) => a -> Regex -> m (Maybe Text, MatchInfo)
- configMatchForeach :: (HasCallStack, MonadIO m, IsConfig a) => a -> Regex -> ConfigMatchCallback -> m ()
- configNew :: (HasCallStack, MonadIO m) => m Config
- configNewDefault :: (HasCallStack, MonadIO m) => m Config
- configNewFromFile :: (HasCallStack, MonadIO m, IsFile a) => a -> m Config
- configOpenLevel :: (HasCallStack, MonadIO m, IsConfig a) => a -> ConfigLevel -> m Config
- configSetBool :: (HasCallStack, MonadIO m, IsConfig a) => a -> Text -> Bool -> m ()
- configSetInt32 :: (HasCallStack, MonadIO m, IsConfig a) => a -> Text -> Int32 -> m ()
- configSetInt64 :: (HasCallStack, MonadIO m, IsConfig a) => a -> Text -> Int64 -> m ()
- configSetString :: (HasCallStack, MonadIO m, IsConfig a) => a -> Text -> Text -> m ()
- configSnapshot :: (HasCallStack, MonadIO m, IsConfig a) => a -> m Config
Exported types
Memory-managed wrapper type.
Instances
Eq Config Source # | |
GObject Config Source # | |
Defined in GI.Ggit.Objects.Config | |
ManagedPtrNewtype Config Source # | |
Defined in GI.Ggit.Objects.Config toManagedPtr :: Config -> ManagedPtr Config | |
TypedObject Config Source # | |
Defined in GI.Ggit.Objects.Config | |
HasParentTypes Config Source # | |
Defined in GI.Ggit.Objects.Config | |
IsGValue (Maybe Config) Source # | Convert |
Defined in GI.Ggit.Objects.Config gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Config -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Config) | |
type ParentTypes Config Source # | |
Defined in GI.Ggit.Objects.Config |
class (GObject o, IsDescendantOf Config o) => IsConfig o Source #
Instances
(GObject o, IsDescendantOf Config o) => IsConfig o Source # | |
Defined in GI.Ggit.Objects.Config |
Methods
Click to display all available methods, including inherited ones
Methods
addFile, bindProperty, bindPropertyFull, deleteEntry, forceFloating, foreach, freezeNotify, getv, isFloating, match, matchForeach, notify, notifyByPspec, openLevel, ref, refSink, runDispose, snapshot, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getBool, getData, getEntry, getInt32, getInt64, getProperty, getQdata, getString.
Setters
setBool, setData, setDataFull, setInt32, setInt64, setProperty, setString.
addFile
:: (HasCallStack, MonadIO m, IsConfig a, IsFile b) | |
=> a |
|
-> b |
|
-> ConfigLevel |
|
-> Bool |
|
-> m () | (Can throw |
Add an on-disk config file instance to an existing config
The on-disk file pointed at by file
will be opened and
parsed; it's expected to be a native Git config file following
the default Git config syntax (see man git-config).
Further queries on this config object will access each of the config file instances in order (instances with a higher priority level will be accessed first).
deleteEntry
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> Text |
|
-> m () | (Can throw |
Delete a config variable from the config file.
findGlobal
:: (HasCallStack, MonadIO m) | |
=> m File | Returns: a |
Find the file representing the users global git configuration. This file
is usually located at $HOME/.gitconfig. This function will try to guess
the full path to that file, if the file exists. The returned file may then
be used with ggit_config_new_from_file
or ggit_config_add_file
. This
function returns Nothing
if the global config could not be found.
findSystem
:: (HasCallStack, MonadIO m) | |
=> m File | Returns: a |
Find the file representing the systems global git configuration. This file
is usually located at /etc/gitconfig on UNIX type systems or
PROGRAMFILES
%\Git\etc\gitconfig on windows. This function will try to guess
the full path to that file, if the file exists. The returned file may then
be used with ggit_config_new_from_file
or ggit_config_add_file
. This
function returns Nothing
if the system config could not be found.
foreach
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> ConfigCallback |
|
-> m () | (Can throw |
Call callback
for each configuration value.
getBool
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> Text |
|
-> m () | (Can throw |
Get a boolean configuration value.
getEntry
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> Text |
|
-> m ConfigEntry | Returns: the entry of |
Get ConfigEntry
of a config variable.
getInt32
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> Text |
|
-> m Int32 | Returns: the value. (Can throw |
Get a int32 configuration value.
getInt64
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> Text |
|
-> m Int64 | Returns: the value. (Can throw |
Get a int64 configuration value.
getString
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> Text |
|
-> m (Maybe Text) | Returns: the string value of |
Get the configuration value of name
as string.
match
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> Regex |
|
-> m (Maybe Text, MatchInfo) | Returns: the value of that matched configuration (Can throw |
Matches a configuration against a regular expression. matchInfo
will
contain the match information if the return value is not Nothing
, otherwise
error
will be set.
matchForeach
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> Regex |
|
-> ConfigMatchCallback |
|
-> m () | (Can throw |
Call callback
for all configurations matching regex
.
new
:: (HasCallStack, MonadIO m) | |
=> m Config | Returns: a |
newDefault
:: (HasCallStack, MonadIO m) | |
=> m Config |
newFromFile
:: (HasCallStack, MonadIO m, IsFile a) | |
=> a |
|
-> m Config |
Create a new config from a single on disk file. This is a convenience
API and is exactly the same as creating an empty Config
using
ggit_config_new
and adding the file with ggit_config_add_file
. The
level will be set to GGIT_CONFIG_LEVEL_LOCAL
. If the config could not be
loaded this function returns Nothing
and error
will be set accordingly.
openLevel
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> ConfigLevel |
|
-> m Config | Returns: the configuration at |
Open a specific level config derived from a multi-level one.
setBool
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> Text |
|
-> Bool |
|
-> m () | (Can throw |
Set a boolean value.
setInt32
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> Text |
|
-> Int32 |
|
-> m () | (Can throw |
Set a int32 value.
setInt64
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> Text |
|
-> Int64 |
|
-> m () | (Can throw |
Set a int64 value.
setString
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> Text |
|
-> Text |
|
-> m () | (Can throw |
Set a new string value of a configuration.
snapshot
:: (HasCallStack, MonadIO m, IsConfig a) | |
=> a |
|
-> m Config | Returns: a new |
Create a snapshot of the current state of the configuration, which allows you to look into a consistent view of the configuration for looking up complex values (e.g. a remote, submodule).