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

Method visibleArguments

lib/help.js:140–154  ·  view source on GitHub ↗

* Get an array of the arguments if any have a description. * * @param {Command} cmd * @returns {Argument[]}

(cmd)

Source from the content-addressed store, hash-verified

138 */
139
140 visibleArguments(cmd) {
141 // Side effect! Apply the legacy descriptions before the arguments are displayed.
142 if (cmd._argsDescription) {
143 cmd.registeredArguments.forEach((argument) => {
144 argument.description =
145 argument.description || cmd._argsDescription[argument.name()] || '';
146 });
147 }
148
149 // If there are any arguments with a description then return all the arguments.
150 if (cmd.registeredArguments.find((argument) => argument.description)) {
151 return cmd.registeredArguments;
152 }
153 return [];
154 }
155
156 /**
157 * Get the command term to show in the list of subcommands.

Callers 4

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

Calls 1

nameMethod · 0.45

Tested by

no test coverage detected