Skip to content
Myr

Merge pull request #761 from mojavelinux/register-on-version-once

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

only register the option:version event once

authored by Tomoaki Abe · committed by GitHub · parents f5abcdb, ba6592f · Browse files · 1 file+3 added−3 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−3 removed

  • other:+3 added−3 removed

1 file+3 added−3 removed

modified:index.js+3 added-3 removed
853 unmodified lines
854Command.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');858 var versionOption = new Option(flags, 'output the version number');859 this._versionOptionName = versionOption.long.substr(2) || 'version';860 this.options.push(versionOption);861 this.on('option:' + this._versionOptionName, function() {862 process.stdout.write(str + '\n');863 process.exit(0);864 });
293 unmodified lines