Skip to content
Myr

Merge pull request #22 from felixge/custom-version-flags

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

Make version flags configurable

authored by TJ Holowaychuk · committed by TJ Holowaychuk · parents 476ddaf, a0b3f1a · Browse files · 1 file+4 added−2 removed
This commit

State

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

Diff stats

1 file+4 added−2 removed

  • other:+4 added−2 removed

1 file+4 added−2 removed

modified:lib/commander.js+4 added-2 removed
504 unmodified lines
505 * This method auto-registers the "-v, --version" flag506 * which will print the version number when passed.507 *508 * @param {String} str509 * @param {String} flags510 * @return {Command} for chaining511 * @api public512 */513513Command.prototype.version = function(str){514Command.prototype.version = function(str, flags){515 if (0 == arguments.length) return this._version;516 this._version = str;517 flags = flags || '-v, --version';516 this.option('-v, --version', 'output the version number');518 this.option(flags, 'output the version number');519 this.on('version', function(){520 console.log(str);521 process.exit(0);522 });
386 unmodified lines