MCPcopy Index your code
hub / github.com/lingodotdev/lingo.dev / buildArgumentListItems

Function buildArgumentListItems

scripts/docs/src/generate-cli-docs.ts:337–372  ·  view source on GitHub ↗
(args: readonly Argument[])

Source from the content-addressed store, hash-verified

335}
336
337function 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
374type BuildCommandSectionOptions = {
375 command: Command;

Callers 1

buildCommandSectionFunction · 0.85

Calls 5

createInlineCodeFunction · 0.85
formatArgumentLabelFunction · 0.85
formatValueFunction · 0.85
createListItemFunction · 0.85
pushMethod · 0.65

Tested by

no test coverage detected