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
Provenance
- Commit
e00c4ca- Tree
839b146- Author
Andrew Nichols <tandrewnichols@gmail.com>- Committer
Andrew Nichols <tandrewnichols@gmail.com>- Parent 1
d17cf57- Parent 2
ebdd789
3 files changed+10 added−11 removed
modified:.travis.yml+3 added-4 removed
123456345language: node_jsnode_js: - 0.4 - 0.6 - 0.8 - 0.10 - "0.6" - "0.8" - "0.10"modified:index.js+5 added-5 removed
3 unmodified lines4 */5 6 var EventEmitter = require('events').EventEmitter;7 var spawn = require('child_process').spawn;8-var fs = require('fs');9-var exists = fs.existsSync;8 var path = require('path');9 var dirname = path.dirname;10 var basename = path.basename;11 129 unmodified lines141 * @return {Command} the new command142 * @api public143 */144 147-Command.prototype.command = function(name, desc){145+Command.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 lines212 Command.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 || [];218+219 var parsed = self.parseOptions(unknown);220 221 // Output help if necessary222 outputHelpIfNecessary(self, parsed.unknown);50 unmodified lines273 * --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 linesmodified:Readme.md+2 added-2 removed
1 # Commander.js2 3 The complete solution for [node.js](http://nodejs.org) command-line interfaces, inspired by Ruby's [commander](https://github.com/visionmedia/commander).4 5- [](http://travis-ci.org/visionmedia/commander.js)5+ [](http://travis-ci.org/visionmedia/commander.js)6 7 ## Installation8 9 $ npm install commander75 unmodified lines85 .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);92 93 console.log(' int: %j', program.integer);115 unmodified lines