0.2.0 • Published 12 years ago

node-commandline v0.2.0

Weekly downloads
37
License
-
Repository
-
Last release
12 years ago

Node-commandline

What is this project about?

The smart Node JS command line parser module provides an easy API that makes an abstraction of a command line. It allows you to specify the order and type of the expected (required) arguments, and the names and types of the optional (named) arguments.

It uses a json-style notation for command lines, for example:

node example.js -debug -encoding:ascii -value:4.5 some ordered arguments -flag:false

All arguments are parsed, and the resulting object will have the following properties:

It is possible to map the ordered arguments to property names by specifying those names at object construction time.

How does it work?

The command line class will after construction expose all argument values as normal JavaScript properties. It can also output the resulting usage syntax, and validate the input. In JavaScript, you can extend objects with properties and functions at run time. node-commandline uses this technique in order to create a model of the command line and it's arguments.

Installation

The easiest way to install node-commandline is to use the NPM package manager:

npm install node-commandline

Where does it come from?

This project is derived from my previous work for the node js serial-to-tcp server.