0.1.14 • Published 11 years ago

opt v0.1.14

Weekly downloads
34
License
-
Repository
github
Last release
11 years ago

opt

revision 0.0.1

Overview

A very simple options module for NodeJS command line apps.

Example

Source code example-1.js

var util = require('util'),
	opt = require('./opt'),
	config = {},
	USAGE = function () {
		return "\n\nUSAGE node example-1.js -- demo options.\n\n SYNOPSIS\n\n\t\tnode example-1.js --help ";
	};

opt.set(['-h','--help'], function () {
		var help = opt.help(), ky;

		console.log(USAGE() + "\n\n OPTIONS\n");
		for (ky in help) {
				console.log("\t" + ky + "\t\t" + help[ky]);     
		}
		console.log("\n\n");
		process.exit(0);
}, "This help document.");
	
// Parse the command line options
if (process.argv.length < 3) {
	console.log("Try using a command line option for demo:\n" + USAGE());
} else {
	opt.parse(process.argv);
}
console.log("\nConfig object properties set by opt: ");
console.log(util.inspect(config));
0.1.14

11 years ago

0.1.13

11 years ago

0.1.11

12 years ago

0.1.1

12 years ago

0.1.0

12 years ago

0.0.10

12 years ago

0.0.9

12 years ago

0.0.8

12 years ago

0.0.7

12 years ago

0.0.6

12 years ago

0.0.5

12 years ago

0.0.4

12 years ago

0.0.3c

12 years ago

0.0.3b

12 years ago

0.0.3

12 years ago

0.0.2e

12 years ago

0.0.2d

12 years ago

0.0.2c

12 years ago

0.0.2b

12 years ago

0.0.2

12 years ago

0.0.1

12 years ago