0.0.7 • Published 10 years ago

node-argv v0.0.7

Weekly downloads
56
License
MIT
Repository
github
Last release
10 years ago

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

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago