git-config
v0.0.7
Published
A simple way to extract out all the contents of a .gitconfig file and return as JSON
Downloads
26,727
Readme
git-config
A simple way to extract out all the contents of a .gitconfig file and return as JSON
Installation
This module is installed via npm:
$ npm install git-config
Example Usage
Asynchronous
var gitConfig = require('git-config');
gitConfig(function (err, config) {
if (err) return done(err);
expect(config.user.name).to.equal('Eugene Ware');
expect(config.user.email).to.equal('[email protected]');
expect(config.github.user).to.equal('eugeneware');
done();
});
Explicitly give a gitconfig file:
var gitConfig = require('git-config');
gitConfig('/my/path/.gitconfig1', function (err, config) {
if (err) return done(err);
expect(config.user.name).to.equal('Eugene Ware');
expect(config.user.email).to.equal('[email protected]');
expect(config.github.user).to.equal('eugeneware');
done();
});
Synchronous
var gitConfig = require('git-config');
var config = gitConfig.sync(); // can pass explit file if you want as well