node-args
Most minimalistic parameter processor for node.
Last updated 3 years ago by christiansandor .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install node-args 
SYNC missed versions from official npm registry.

Build Status Coverage Status NSP Status

Args

The most minimalistic parameter processor for node. Really.

Usage

Couldn't be simpler, just install it like:

npm install node-args

And use it as:

var args = require('node-args');

You're done.

No other options needed. If you need more features, use commander or whatever else you fancy.

Call node with

  • your named parameters prefixed with --
  • your shorthand parameters prefixed with - (with multiple parameters in mind like -ab = -a -b)
  • your parameters and assigned values separated with a space or an equals sign
node my.js -t -ab=2 -c false -p no some additional data 2 --argsis awesome --another=1

So you will get:

{
    _: ['node', node file path],
    additional: ['some', 'additional', 'data', 2],
    t: true,
    a: 2,
    b: 2,
    c: false,
    p: 'no',
    argsis: 'awesome',
    another: 1
};

Yay.

Side note: It's build upon TypeScript and tested thoroughly.

Build

The source files are in the src folder, and the available scripts are

  • npm run build:src to build without tests
  • npm run build:tests to build with tests
  • npm test to run tests

Please do contribute if you find a better, faster or easier way to process arguments.

Current Tags

  • 2.1.8                                ...           latest (3 years ago)

13 Versions

  • 2.1.8                                ...           3 years ago
  • 2.1.7                                ...           3 years ago
  • 2.1.6                                ...           3 years ago
  • 2.1.5                                ...           3 years ago
  • 2.1.4                                ...           3 years ago
  • 2.1.3                                ...           3 years ago
  • 2.1.1                                ...           3 years ago
  • 2.1.0                                ...           3 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 68
This Month 117
Last Day 1
Last Week 47
Last Month 157
Dependencies (0)
None
Dev Dependencies (8)

Copyright 2014 - 2016 © taobao.org |