group-args
CLI helper to group commandline arguments
Install
$ npm install --save group-args
Usage
node ./cli.js --foo --bar something --group-a 1 --group-b 2
const groupArgs = ; // process.argv: [;//=> {foo: true, bar: 'something', group: { a: 1, b: 2 }}
API
groupArgs(key, [options], [minimistOptions])
key
Type: string|array|object
Group arguments by key. When passing an object it is
Could be 'key'
, ['key1','key2']
, {alias1: 'key1', alias2: 'key2'}
options
argv
Type: array|object
Default: process.argv.slice(2)
Arguments array or already parsed arguments.
delimiter
Type: string
Default: -
Delimiter between group identifier & key.
strict
Type: bool
Default: true
Disable to allow camelCased arguments provided by e.g. meow
alias
Type: string
Default: undefined
Alias for identifier (short opt)
camelCase
Type: bool
Default: true
camelCase grouped arguments
minimistOptions
See minimist
License
MIT © Ben Zörb