Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaelzhang/nodegit-read-config
Read config for @nodegit commands
https://github.com/kaelzhang/nodegit-read-config
node-git util
Last synced: 12 days ago
JSON representation
Read config for @nodegit commands
- Host: GitHub
- URL: https://github.com/kaelzhang/nodegit-read-config
- Owner: kaelzhang
- License: other
- Created: 2019-05-05T14:15:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-05-06T13:51:11.000Z (over 5 years ago)
- Last Synced: 2024-04-15T12:33:04.741Z (7 months ago)
- Topics: node-git, util
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/kaelzhang/nodegit-read-config.svg?branch=master)](https://travis-ci.org/kaelzhang/nodegit-read-config)
[![Coverage](https://codecov.io/gh/kaelzhang/nodegit-read-config/branch/master/graph/badge.svg)](https://codecov.io/gh/kaelzhang/nodegit-read-config)# @nodegit/read-config
Read config for @nodegit commands
## Install
```sh
$ npm i @nodegit/read-config
```## Usage
```js
const config = require('@nodegit/read-config')
const {read, edit, path} = config('push', {
defaults: {
allowForcePush: true
}
})console.log(await read())
```## config(name, options)
- **name** `string` name of the config which indicates that the config file will be located at `~/.nodegit/config/${name}.js`
- **options** `Object`
- **defaults?** `Object` the default value of the configuration
- **defaultFileContent?** `string | Buffer` the default configuration content to be used if there is no config file found.If `options.defaults` is specified, then it will ignore `options.defaultFileContent`.
```js
const {read} = config('push', {
defaultFileContent:
`module.exports = {
editor: 'vscode'
}`
})const {editor} = await read()
```### await read(): Object
Get the local config. If there is no config file found, it will create one.
### await edit(): void
Open the default editor and edit the config file
### getter: path
Returns `path` the absolute pathname of the config file
## License
[MIT](LICENSE)