node-cli

node-cli provide various features in order to deal with argument collections such as process.argv

npm install node-cli
1 downloads in the last day
9 downloads in the last week
34 downloads in the last month

node-cli

node-cli is a small node module. I build it in order to easily handle node command line arguments.

usage

install node-cli by using npm.

npm install node-cli

or with option -g (global) in order to make it available globally

npm install node-cli -g

load the module within your node script by using require.

var cli = require("node-cli");

configuration

The entire node-cli configuration is handeld by the init([optionl]args, [optional]delimiter) method. By default, node's system arguments are passed to node-cli (process.argv). The default delimiter is '='.

operations

  • hasArguments(includeSystemArguments)
  • containsArgument(argument)
  • getArguments()
  • getArgumentAt(index)
  • getArgumentValueAt(index)
  • getArgument(key)
  • getArgumentAt(key)
  • getCount()
  • require(requiredArguments, onSuccess, onError)

samples

.... read my post at http://thorstenhans.github.com/blog/2013/01/30/dealing-with-arguments-in-node-dot-js/

tests

node-cli has been written using TDD, in order to execute the tests, you need to install mocha. You can easily install mocha by using npm. npm install mocha

By using mocha -R spec tests/* you can run all existing tests.

npm loves you