We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f5abcdb + ba6592f commit 445e80eCopy full SHA for 445e80e
index.js
@@ -855,9 +855,9 @@ Command.prototype.version = function(str, flags) {
855
if (arguments.length === 0) return this._version;
856
this._version = str;
857
flags = flags || '-V, --version';
858
- var longOptIndex = flags.indexOf('--');
859
- this._versionOptionName = ~longOptIndex ? flags.substr(longOptIndex + 2) : 'version';
860
- this.option(flags, 'output the version number');
+ var versionOption = new Option(flags, 'output the version number');
+ this._versionOptionName = versionOption.long.substr(2) || 'version';
+ this.options.push(versionOption);
861
this.on('option:' + this._versionOptionName, function() {
862
process.stdout.write(str + '\n');
863
process.exit(0);
0 commit comments