-
-
- Command line usage
-
-
-
- {command.usage.replaceAll(ANSI_RE, "").slice("usage: ".length)}
-
-
-
-
-
-
-
- {Object.entries(options).map(([heading, flags]) => {
- const id = heading.toLowerCase().replace(/\s/g, "-");
-
- const renderedFlags = flags.toSorted((a, b) =>
- a.name.localeCompare(b.name)
- ).map((flag) => renderOption(id, flag, helpers));
-
- toc.push({
- text: heading,
- slug: id,
- children: [],
- });
-
- return (
- <>
-
- {heading}
-
- {renderedFlags}
- >
- );
- })}
-
- );
-
- return {
- rendered,
- toc,
- };
-}
-
-function renderOption(group: string, arg, helpers: Lume.Helpers) {
- const id = `${group}-${arg.name}`;
-
- let docsLink = null;
- let help = arg.help.replaceAll(ANSI_RE, "");
- const helpLines = help.split("\n");
- const helpLinesDocsIndex = helpLines.findLastIndex((line) =>
- line.toLowerCase()
- .trim()
- .startsWith("docs:")
- );
- if (helpLinesDocsIndex !== -1) {
- help = helpLines.slice(0, helpLinesDocsIndex).join("\n");
- docsLink = helpLines[helpLinesDocsIndex].trim().slice("docs:".length);
- }
-
- return (
- <>
-