node-argv
Parse argv as a String, then feed minimist and expose the interface:
{
options: {},
commands: [],
through: {
options: {},
commands: []
},
input: []
}
Parse String
var argv = require('node-argv')
, options = {};
argv('first command --hello true -c "value" -- second command -b', {});
{
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