Parse command line arguments
npm install @keg-hub/args-parse* With yarn
``bash`
yarn add @keg-hub/args-parse
* With npm
`bash`
npm install @keg-hub/args-parse
`js
;(() => {
const { argsParse } = require('@keg-hub/args-parse')
const task = {
options: {
// Define required
doo: {
description: "dew the doo",
require: true,
},
// Define defaults
foo: {
description: 'I am foo bar',
default: 'bar'
},
baz: {
// Define alias
alias: [ 'zoo' ],
description: 'The baz with bas',
},
}
}
const parsed = await argsParse({
task,
args: [ 'doo=f', '--zoo', 'bas', ],
})
expect(parsed.doo).toBe(false)
expect(parsed.foo).toBe('bar')
expect(parsed.baz).toBe('bas')
})()
`
environment vairable to overwrite the path to the parse config
* Path should be relative to the applications root directory
* See default config
* Custom Configs should match the keys within the default config
* bools && environment`