(args: readonly Argument[])
| 335 | } |
| 336 | |
| 337 | function buildArgumentListItems(args: readonly Argument[]): ListItem[] { |
| 338 | return args.map((arg) => { |
| 339 | const children: PhrasingContent[] = [ |
| 340 | createInlineCode(formatArgumentLabel(arg)), |
| 341 | ]; |
| 342 | |
| 343 | if (arg.description) { |
| 344 | children.push({ type: "text", value: ` — ${arg.description}` }); |
| 345 | } |
| 346 | |
| 347 | const details: string[] = []; |
| 348 | |
| 349 | if (arg.defaultValueDescription) { |
| 350 | details.push(`default: ${arg.defaultValueDescription}`); |
| 351 | } else if (arg.defaultValue !== undefined) { |
| 352 | details.push(`default: ${formatValue(arg.defaultValue)}`); |
| 353 | } |
| 354 | |
| 355 | if (arg.argChoices && arg.argChoices.length > 0) { |
| 356 | details.push(`choices: ${arg.argChoices.join(", ")}`); |
| 357 | } |
| 358 | |
| 359 | if (!arg.required) { |
| 360 | details.push("optional"); |
| 361 | } |
| 362 | |
| 363 | if (details.length > 0) { |
| 364 | children.push({ |
| 365 | type: "text", |
| 366 | value: ` (${details.join("; ")})`, |
| 367 | }); |
| 368 | } |
| 369 | |
| 370 | return createListItem(children); |
| 371 | }); |
| 372 | } |
| 373 | |
| 374 | type BuildCommandSectionOptions = { |
| 375 | command: Command; |
no test coverage detected