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

Function buildCommandDoc

scripts/docs/src/generate-cli-docs.ts:513–546  ·  view source on GitHub ↗
(
  command: Command,
  rootName: string,
  options?: BuildCommandDocOptions,
)

Source from the content-addressed store, hash-verified

511};
512
513function buildCommandDoc(
514 command: Command,
515 rootName: string,
516 options?: BuildCommandDocOptions,
517): CommandDoc {
518 const useRootIntro = options?.useRootIntro ?? true;
519 const commandPath = getCommandPath(rootName, [], command);
520 const title = commandPath;
521 const subtitle = `CLI reference docs for ${command.name()} command`;
522 const root: Root = {
523 type: "root",
524 children: buildCommandSection({
525 command,
526 rootName,
527 ancestors: [],
528 depth: 2,
529 useRootIntro,
530 }),
531 };
532
533 const markdown = toMarkdown(root);
534 const frontmatter = [
535 FRONTMATTER_DELIMITER,
536 `title: ${formatYamlValue(title)}`,
537 `subtitle: ${formatYamlValue(subtitle)}`,
538 FRONTMATTER_DELIMITER,
539 "",
540 ].join("\n");
541
542 const mdx = `${frontmatter}${markdown}\n`;
543 const fileName = `${slugifyCommandName(command.name())}.mdx`;
544
545 return { fileName, markdown, mdx, commandPath };
546}
547
548function buildIndexDoc(commands: Command[], rootName: string): CommandDoc {
549 const root: Root = {

Callers 1

mainFunction · 0.85

Calls 5

getCommandPathFunction · 0.85
buildCommandSectionFunction · 0.85
toMarkdownFunction · 0.85
formatYamlValueFunction · 0.85
slugifyCommandNameFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…