guld-git-config-ini

2.0.13 • Public • Published

guld-git-config-ini

source issues documentation

node package manager travis-ci lgtm david-dm david-dm

A git config ini encoder/decoder for guld

Install

Node
npm i guld-git-config-ini
Browser
curl https///bitbucket.org/guld/tech-js-node_modules-guld-git-config-ini/raw/guld/ini.min.js -o ini.min.js

Usage

Consider an git config ini-file .git/config that looks like this:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = https://github.com/nfer/git-config-ini
    fetch = +refs/heads/*:refs/remotes/origin/*
[user]
    name = Nfer Zhuang

You can read, manipulate and write the ini-file like so:

var fs = require('fs')
  , ini = require('ini')

var config = ini.parse(fs.readFileSync('.git/config', 'utf-8'))

config.core.filemode = false
config.user.name = 'nfer'
config.user.email = 'nfer@nferzhuang.com'

fs.writeFileSync('.git/config', ini.stringify(config))

Browser

This script has been bundled for browser use and is available as global var gitConfigIni.

<html>
  <body>
    <script src="ini.min.js"></script>
    <script>
      console.log(gitConfigIni)
    </script>
  </body>
</html>

API

decode(inistring)

Decode the ini-style formatted inistring into a nested object.

parse(inistring)

Alias for decode(inistring)

encode(object)

Encode the object object into an ini-style formatted string.

stringify(object)

Alias for encode(object)

License

MIT Copyright Nfer Zhuang nfer.zhuang@gmail.com

Readme

Keywords

Package Sidebar

Install

npm i guld-git-config-ini

Weekly Downloads

5

Version

2.0.13

License

MIT

Unpacked Size

15.9 kB

Total Files

5

Last publish

Collaborators

  • isysd