Skip to content

A simple way to extract out all the contents of a .gitconfig file and return as JSON

License

Notifications You must be signed in to change notification settings

eugeneware/git-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-config

A simple way to extract out all the contents of a .gitconfig file and return as JSON

build status

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('eugene@noblesamurai.com');
  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('eugene@noblesamurai.com');
  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

About

A simple way to extract out all the contents of a .gitconfig file and return as JSON

Resources

License

Stars

Watchers

Forks

Packages

No packages published