* Get the argument description to show in the list of arguments. * * @param {Argument} argument * @return {string}
(argument)
| 371 | */ |
| 372 | |
| 373 | argumentDescription(argument) { |
| 374 | const extraInfo = []; |
| 375 | if (argument.argChoices) { |
| 376 | extraInfo.push( |
| 377 | // use stringify to match the display of the default value |
| 378 | `choices: ${argument.argChoices.map((choice) => JSON.stringify(choice)).join(', ')}`, |
| 379 | ); |
| 380 | } |
| 381 | if (argument.defaultValue !== undefined) { |
| 382 | extraInfo.push( |
| 383 | `default: ${argument.defaultValueDescription || JSON.stringify(argument.defaultValue)}`, |
| 384 | ); |
| 385 | } |
| 386 | if (extraInfo.length > 0) { |
| 387 | const extraDescription = `(${extraInfo.join(', ')})`; |
| 388 | if (argument.description) { |
| 389 | return `${argument.description} ${extraDescription}`; |
| 390 | } |
| 391 | return extraDescription; |
| 392 | } |
| 393 | return argument.description; |
| 394 | } |
| 395 | |
| 396 | /** |
| 397 | * Format a list of items, given a heading and an array of formatted items. |
no outgoing calls
no test coverage detected