0.1.9 • Published 10 years ago
node-flags v0.1.9
node-flags
Simple module for parsing double-dash flags in node.
Install
$ npm install node-flagsUsage
This module parses double-dash flags from node's process.argv object. Flags are specified when running a node script. For example:
$ node server --foo=barTo use, require in the module:
var flags = require("node-flags");
var foo = flags.get('foo');The flags.get() method parses flags with the following behavior:
- A flag with the value of
FALSE,false,TRUE, ortrueis parsed as a boolean. - A flag with the value of
0or1is parsed as a number. - A flag that is exists, but has no value is parsed as boolean true.
- A flag that does not exist is parsed as boolean false.
- A flag that exists and has any other value is parsed as a string.
Test
$ npm testChangelog
As of 0.1.6, flags with values of 0 or 1 are parsed as numbers.