Skip to content
Myr

Make version flags configurable

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

I would like to use '-v' for '--verbose' and only expose version as '--version'. This change allows me to do this without changing the defaults for everybody else.

authored by Felix Geisendörfer · committed by Felix Geisendörfer · parent 476ddaf · Browse files · 1 file+3 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+3 added−2 removed

  • other:+3 added−2 removed

1 file+3 added−2 removed

modified:lib/commander.js+3 added-2 removed
508 unmodified lines
509 * @return {Command} for chaining510 * @api public511 */512513Command.prototype.version = function(str){513Command.prototype.version = function(str, flags){514 if (0 == arguments.length) return this._version;515 this._version = str;516 flags = flags || '-v, --version';516 this.option('-v, --version', 'output the version number');517 this.option(flags, 'output the version number');518 this.on('version', function(){519 console.log(str);520 process.exit(0);521 });
386 unmodified lines