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

Method usage

lib/command.js:2318–2336  ·  view source on GitHub ↗

* Set / get the command usage `str`. * * @param {string} [str] * @return {(string|Command)}

(str)

Source from the content-addressed store, hash-verified

2316 */
2317
2318 usage(str) {
2319 if (str === undefined) {
2320 if (this._usage) return this._usage;
2321
2322 const args = this.registeredArguments.map((arg) => {
2323 return humanReadableArgName(arg);
2324 });
2325 return []
2326 .concat(
2327 this.options.length || this._helpOption !== null ? '[options]' : [],
2328 this.commands.length ? '[command]' : [],
2329 this.registeredArguments.length ? args : [],
2330 )
2331 .join(' ');
2332 }
2333
2334 this._usage = str;
2335 return this;
2336 }
2337
2338 /**
2339 * Get or set the name of the command.

Callers 7

commandUsageMethod · 0.80
index.test-d.tsFile · 0.80

Calls 1

humanReadableArgNameFunction · 0.90

Tested by

no test coverage detected