( command: Command, rootName: string, options?: BuildCommandDocOptions, )
| 511 | }; |
| 512 | |
| 513 | function 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 | |
| 548 | function buildIndexDoc(commands: Command[], rootName: string): CommandDoc { |
| 549 | const root: Root = { |
no test coverage detected
searching dependent graphs…