node-argv-fork
v1.0.0
Published
Parse argv as String or process.argv
Downloads
3
Readme
node-argv
Parse argv as a String, then feed minimist and expose the interface:
{
options: {},
commands: [],
through: { // only if '--' is given
options: {},
commands: []
},
input: [] // parsed argv
}
Parse String
var argv = require('node-argv')
, options = {}; // minimist options
argv('first command --hello true -c "value" -- second command -b', {});
// return
{
options: {
hello: true,
c: 'value'
},
commands: ['first', 'command'],
through: {
options: {
b: true
},
commands: ['second', 'command']
},
input: ['first', 'command', '--hello', 'true', '-c', 'value', '--', 'second', 'command', '-b']
}
Parse Array
This module also parses an Array directly using minimist
but exposing the above interface
var argv = require('node-argv');
argv(process.argv.slice(2), {});
Target
The third parameter is the optional target
, if given it will be used to store the result attributes.
install
With npm do:
npm install node-argv
license
MIT