MCPcopy
hub / github.com/tj/commander.js / version

Method version

lib/command.js:2209–2223  ·  view source on GitHub ↗

* Get or set the program version. * * This method auto-registers the "-V, --version" option which will print the version number. * * You can optionally supply the flags and description to override the defaults. * * @param {string} [str] * @param {string} [flags] * @param {str

(str, flags, description)

Source from the content-addressed store, hash-verified

2207 */
2208
2209 version(str, flags, description) {
2210 if (str === undefined) return this._version;
2211 this._version = str;
2212 flags = flags || '-V, --version';
2213 description = description || 'output the version number';
2214 const versionOption = this.createOption(flags, description);
2215 this._versionOptionName = versionOption.attributeName();
2216 this._registerOption(versionOption);
2217
2218 this.on('option:' + versionOption.name(), () => {
2219 this._outputConfiguration.writeOut(`${str}\n`);
2220 this._exit(0, 'commander.version', str);
2221 });
2222 return this;
2223 }
2224
2225 /**
2226 * Set the description.

Calls 6

createOptionMethod · 0.95
_registerOptionMethod · 0.95
_exitMethod · 0.95
attributeNameMethod · 0.80
writeOutMethod · 0.80
nameMethod · 0.45

Tested by

no test coverage detected