1.0.1 • Published 5 years ago
@nodegit/read-config v1.0.1
@nodegit/read-config
Read config for @nodegit commands
Install
$ npm i @nodegit/read-config
Usage
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.
- 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