Xgit v0.8.0 Xgit.Config View Source

Provides convenience functions to get specific configuration values from a repository.

IMPORTANT: The on-disk repository implementation (Xgit.Repository.OnDisk) does not examine configuration directives in global or home directory.

This module should be considered roughly analogous to the git config command.

Link to this section Summary

Functions

Return the config value interpreted as a boolean.

Return the config value interpreted as an integer.

If there is a single string for this variable, return it.

Get the list of strings for this variable.

Link to this section Functions

Link to this function

get_boolean(repository, section, subsection \\ nil, name, default)

View Source
get_boolean(
  repository :: Xgit.Repository.t(),
  section :: String.t(),
  subsection :: String.t() | nil,
  name :: String.t(),
  default :: boolean()
) :: boolean()

Return the config value interpreted as a boolean.

Use default if it can not be interpreted as such.

Link to this function

get_integer(repository, section, subsection \\ nil, name, default)

View Source
get_integer(
  repository :: Xgit.Repository.t(),
  section :: String.t(),
  subsection :: String.t() | nil,
  name :: String.t(),
  default :: integer()
) :: integer()

Return the config value interpreted as an integer.

Use default if it can not be interpreted as such.

Link to this function

get_string(repository, section, subsection \\ nil, name)

View Source
get_string(
  repository :: Xgit.Repository.t(),
  section :: String.t(),
  subsection :: String.t() | nil,
  name :: String.t()
) :: String.t() | nil | :empty

If there is a single string for this variable, return it.

If there are zero or multiple values for this variable, return nil.

If there is exactly one value, but it was implied (missing =), return :empty.

Link to this function

get_string_list(repository, section, subsection \\ nil, name)

View Source
get_string_list(
  repository :: Xgit.Repository.t(),
  section :: String.t(),
  subsection :: String.t() | nil,
  name :: String.t()
) :: [String.t() | nil]

Get the list of strings for this variable.