Skip to content
Myr

Merge upstream master

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Andrew Nichols · committed by Andrew Nichols · parents d17cf57, ebdd789 · Browse files · 3 files+10 added−11 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+10 added−11 removed

  • other:+10 added−11 removed

3 files+10 added−11 removed

modified:.travis.yml+3 added-4 removed
modified:index.js+5 added-5 removed
3 unmodified lines
4 */56var EventEmitter = require('events').EventEmitter;7var spawn = require('child_process').spawn;8var fs = require('fs');9var exists = fs.existsSync;8var path = require('path');9var dirname = path.dirname;10var basename = path.basename;11
129 unmodified lines
141 * @return {Command} the new command142 * @api public143 */144147Command.prototype.command = function(name, desc){145Command.prototype.command = function(name, desc) {146 var args = name.split(/ +/);147 var cmd = new Command(args.shift());148 if (desc) cmd.description(desc);149 if (desc) this.executables = true;
62 unmodified lines
212Command.prototype.action = function(fn){213 var self = this;214 var listener = function(args, unknown){215 // Parse any so-far unknown options216 args = args || [];217 unknown = unknown || [];218219 var parsed = self.parseOptions(unknown);220221 // Output help if necessary222 outputHelpIfNecessary(self, parsed.unknown);
50 unmodified lines
273 * --pepper274 * program.pepper275 * // => Boolean276 *277 * // simple boolean defaulting to false277 * // simple boolean defaulting to true278 * program.option('-C, --no-cheese', 'remove cheese');279 *280 * program.cheese281 * // => true282 *283 * --no-cheese284 * program.cheese285 * // => true285 * // => false286 *287 * // required argument288 * program.option('-C, --chdir <path>', 'change the working directory');289 *
587 unmodified lines
modified:Readme.md+2 added-2 removed
1# Commander.js23 The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).45 [![Build Status](https://secure.travis-ci.org/visionmedia/commander.js.png)](http://travis-ci.org/visionmedia/commander.js)5 [![Build Status](https://api.travis-ci.org/visionmedia/commander.js.svg)](http://travis-ci.org/visionmedia/commander.js)67## Installation89 $ npm install commander
75 unmodified lines
85 .option('-f, --float <n>', 'A float argument', parseFloat)86 .option('-r, --range <a>..<b>', 'A range', range)87 .option('-l, --list <items>', 'A list', list)88 .option('-o, --optional [value]', 'An optional value')89 .option('-c, --collect [value]', 'A repeatable value', [])89 .option('-c, --collect [value]', 'A repeatable value', collect, [])90 .option('-v, --verbose', 'A value that can be increased', increaseVerbosity, 0)91 .parse(process.argv);9293console.log(' int: %j', program.integer);
115 unmodified lines