cli-list
Break CLI lists into arrays
Given a "CLI list" like so:
foo bar, baz --qux, oof
We can expect process.argv
to be something such as:
'foo' 'bar,' 'baz' '--qux,' 'oof'
If we run this through the cli-list
function we can split it into sub-arrays where the commas are:
'foo' 'bar' 'baz' '--qux' 'oof'
Theses arrays maintain the process.argv
style, so they can be used in parity with things like minimist.
Installation
$ npm install --save cli-list
Usage
var list = ;var opts = ;
ES6 + Minimist:
;;const opts = ;
Examples
Given:
$ test foo --bar, baz, --qux
Expect:
[['foo', '--bar'], ['baz'], ['--qux']]
Credits
Jamen Marzonie |