1.0.1 • Published 7 years ago
@nodegit/read-config v1.0.1
@nodegit/read-config
Read config for @nodegit commands
Install
$ npm i @nodegit/read-configUsage
const config = require('@nodegit/read-config')
const {read, edit, path} = config('push', {
defaults: {
allowForcePush: true
}
})
console.log(await read())config(name, options)
- name
stringname of the config which indicates that the config file will be located at~/.nodegit/config/${name}.js - options
Object- defaults?
Objectthe default value of the configuration - defaultFileContent?
string | Bufferthe default configuration content to be used if there is no config file found.
- defaults?
If options.defaults is specified, then it will ignore options.defaultFileContent.
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