Module Config
Class "Config".
Functions
Config.new () | Create a new Config object. |
Config.open (path) | Create a new Config object. |
Config:add_file_ondisk (path, priority) | object method. |
Config:delete (name) | object method. |
Config:free () | Destroy this object (will be called by Garbage Collector). |
Config:get_bool (name) | object method. |
Config:get_int32 (name) | object method. |
Config:get_int64 (name) | object method. |
Config:get_string (name) | object method. |
Config:set_bool (value, name) | object method. |
Config:set_int32 (name, value) | object method. |
Config:set_int64 (name, value) | object method. |
Config:set_string (name, value) | object method. |
Functions
- Config.new ()
-
Create a new Config object.
Calls git_config_new:
This object is empty, so you have to add a file to it before you can do anything with it.
Return values:
- Config or
nil
on error. - Error string.
- Config or
- Config.open (path)
-
Create a new Config object.
Calls git_config_open_ondisk:
This method is a simple utility wrapper for the following sequence of calls: - git_config_new - git_config_add_file_ondisk
Parameters
-
path: Path to the on-disk file to open. Must be of type
string
.
Return values:
- Config or
nil
on error. - Error string.
-
path: Path to the on-disk file to open. Must be of type
- Config:add_file_ondisk (path, priority)
-
object method.
Calls git_config_add_file_ondisk:
The on-disk file pointed at by `path` 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).
Note that the configuration object will free the file automatically.
Further queries on this config object will access each of the config file instances in order (instances with a higher priority will be accessed first).
Parameters
-
path: path to the configuration file (backend) to add. Must be of type
string
. -
priority: the priority the backend should have. Must be of type
integer
.
Return values:
true
if no error.- Error string.
-
path: path to the configuration file (backend) to add. Must be of type
- Config:delete (name)
-
object method.
Calls git_config_delete:
Parameters
-
name: the variable to delete. Must be of type
string
.
Return values:
true
if no error.- Error string.
-
name: the variable to delete. Must be of type
- Config:free ()
-
Destroy this object (will be called by Garbage Collector).
Calls git_config_free:
- Config:get_bool (name)
-
object method.
Calls git_config_get_bool:
This function uses the usual C convention of 0 being false and anything else true.
Parameters
-
name: the variable's name. Must be of type
string
.
Return values:
boolean
ornil
on error.- Error string.
-
name: the variable's name. Must be of type
- Config:get_int32 (name)
-
object method.
Parameters
-
name: Must be of type
string
.
Return values:
integer
ornil
on error.- Error string.
-
name: Must be of type
- Config:get_int64 (name)
-
object method.
Parameters
-
name: Must be of type
string
.
Return values:
integer
ornil
on error.- Error string.
-
name: Must be of type
- Config:get_string (name)
-
object method.
Calls git_config_get_string:
The string is owned by the variable and should not be freed by the user.
Parameters
-
name: the variable's name. Must be of type
string
.
Return values:
string
ornil
on error.- Error string.
-
name: the variable's name. Must be of type
- Config:set_bool (value, name)
-
object method.
Calls git_config_set_bool:
Parameters
-
value: the value to store. Must be of type
boolean
. -
name: the variable's name. Must be of type
string
.
Return values:
true
if no error.- Error string.
-
value: the value to store. Must be of type
- Config:set_int32 (name, value)
-
object method.
Parameters
-
name: Must be of type
string
. -
value: Must be of type
integer
.
Return values:
true
if no error.- Error string.
-
name: Must be of type
- Config:set_int64 (name, value)
-
object method.
Parameters
-
name: Must be of type
string
. -
value: Must be of type
integer
.
Return values:
true
if no error.- Error string.
-
name: Must be of type
- Config:set_string (name, value)
-
object method.
Calls git_config_set_string:
A copy of the string is made and the user is free to use it afterwards.
Parameters
-
name: the variable's name. Must be of type
string
. -
value: the string to store.. Must be of type
string
.
Return values:
true
if no error.- Error string.
-
name: the variable's name. Must be of type