jmcs / python-gitconfig

Small wrapper around the git cli to expose git configuration as a mapping

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This project was moved to Gitlab

Git Config

Overview

gitconfig is a small wrapper around the git cli to expose git configuration as a mapping.

Usage

gitconfig is pretty straight forward:

>>> import gitconfig
>>> config = gitconfig.GitConfig()
>>> config['test.test'] = 'test value'
>>> config['test.test']
'test value'
>>> del config['test.test']
>>> config['test.test']
Traceback (most recent call last):
    ...
KeyError

By default values are set locally (keeping the behaviour of git config KEY VALUE), you can also store the values for the user or the system by providing the right space when initializing GitConfig:

>>> config = gitconfig.GitConfig('local')
>>> config = gitconfig.GitConfig('global')
>>> config = gitconfig.GitConfig('system')

Key are always read from every available configuration, and will respect the same rules as git config to get the key values.

About

Small wrapper around the git cli to expose git configuration as a mapping

License:Apache License 2.0


Languages

Language:Python 100.0%