gi-ggit-1.0.9: libgit2-glib bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Ggit.Objects.Config

Description

Represents a git configuration.

Synopsis

Exported types

newtype Config Source #

Memory-managed wrapper type.

Constructors

Config (ManagedPtr Config) 

Instances

Instances details
Eq Config Source # 
Instance details

Defined in GI.Ggit.Objects.Config

Methods

(==) :: Config -> Config -> Bool

(/=) :: Config -> Config -> Bool

GObject Config Source # 
Instance details

Defined in GI.Ggit.Objects.Config

ManagedPtrNewtype Config Source # 
Instance details

Defined in GI.Ggit.Objects.Config

Methods

toManagedPtr :: Config -> ManagedPtr Config

TypedObject Config Source # 
Instance details

Defined in GI.Ggit.Objects.Config

Methods

glibType :: IO GType

IsGValue Config Source #

Convert Config to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.Ggit.Objects.Config

Methods

toGValue :: Config -> IO GValue

fromGValue :: GValue -> IO Config

HasParentTypes Config Source # 
Instance details

Defined in GI.Ggit.Objects.Config

type ParentTypes Config Source # 
Instance details

Defined in GI.Ggit.Objects.Config

type ParentTypes Config = '[Native, ObjectFactoryBase, Object]

class (GObject o, IsDescendantOf Config o) => IsConfig o Source #

Type class for types which can be safely cast to Config, for instance with toConfig.

Instances

Instances details
(GObject o, IsDescendantOf Config o) => IsConfig o Source # 
Instance details

Defined in GI.Ggit.Objects.Config

toConfig :: (MonadIO m, IsConfig o) => o -> m Config Source #

Cast to Config, for types for which this is known to be safe. For general casts, use castTo.

Methods

Overloaded methods

addFile

configAddFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a, IsFile b) 
=> a

config: a Config.

-> b

file: a File.

-> ConfigLevel

level: a ConfigLevel.

-> Bool

force: if a config file already exists for the given priority level, replace it.

-> m ()

(Can throw GError)

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

configDeleteEntry Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> Text

name: the configuration value.

-> m ()

(Can throw GError)

Delete a config variable from the config file.

findGlobal

configFindGlobal Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m File

Returns: a File or Nothing if the global config could not be found.

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

configFindSystem Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m File

Returns: a File or Nothing if the system config could not be found.

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

configForeach Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> ConfigCallback

callback: a ConfigCallback.

-> m ()

(Can throw GError)

Call callback for each configuration value.

getBool

configGetBool Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> Text

name: the name of the configuration value.

-> m ()

(Can throw GError)

Get a boolean configuration value.

getEntry

configGetEntry Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> Text

name: the configuration name.

-> m ConfigEntry

Returns: the entry of name, or Nothing if such a value does not exist. (Can throw GError)

Get ConfigEntry of a config variable.

getInt32

configGetInt32 Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> Text

name: the name of the configuration value.

-> m Int32

Returns: the value. (Can throw GError)

Get a int32 configuration value.

getInt64

configGetInt64 Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> Text

name: the name of the configuration value.

-> m Int64

Returns: the value. (Can throw GError)

Get a int64 configuration value.

getString

configGetString Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> Text

name: the name of the configuration value.

-> m (Maybe Text)

Returns: the string value of name, or Nothing if such a value does not exist (Can throw GError)

Get the configuration value of name as string.

match

configMatch Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> Regex

regex: a Regex.

-> m (Maybe Text, MatchInfo)

Returns: the value of that matched configuration (Can throw GError)

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

configMatchForeach Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> Regex

regex: a Regex.

-> ConfigMatchCallback

callback: a ConfigMatchCallback.

-> m ()

(Can throw GError)

Call callback for all configurations matching regex.

new

configNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Config

Returns: a Config.

Create a new config. See also ggit_config_get_default() to get a Config representing the global, XDG and system configuration files. To get a Config for a repository use ggit_repository_get_config instead.

newDefault

configNewDefault Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Config

Returns: A Config (Can throw GError)

Get the global, XDG and system configuration files merged into one Config with their appropriate priority levels. If an error occured trying to load the various configuration files, this function will return Nothing and error will be set accordingly.

newFromFile

configNewFromFile Source #

Arguments

:: (HasCallStack, MonadIO m, IsFile a) 
=> a

file: the file to load.

-> m Config

Returns: a Config. (Can throw GError)

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

configOpenLevel Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> ConfigLevel

level: the level to open.

-> m Config

Returns: the configuration at level, or Nothing. (Can throw GError)

Open a specific level config derived from a multi-level one.

setBool

configSetBool Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> Text

name: the name of the configuration value.

-> Bool

value: the new value.

-> m ()

(Can throw GError)

Set a boolean value.

setInt32

configSetInt32 Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> Text

name: the name of the configuration value.

-> Int32

value: the new value.

-> m ()

(Can throw GError)

Set a int32 value.

setInt64

configSetInt64 Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> Text

name: the name of the configuration value.

-> Int64

value: the new value.

-> m ()

(Can throw GError)

Set a int64 value.

setString

configSetString Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> Text

name: the name of the configuration value.

-> Text

value: the new value.

-> m ()

(Can throw GError)

Set a new string value of a configuration.

snapshot

configSnapshot Source #

Arguments

:: (HasCallStack, MonadIO m, IsConfig a) 
=> a

config: a Config.

-> m Config

Returns: a new Config, or Nothing if an error occurred. (Can throw GError)

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).