import { CliReference } from "@pixxl-tools/components";
// In Server Components:
import { CliReference } from "@pixxl-tools/components/server";| Prop | Type | Default | Description |
|---|---|---|---|
commands (required) | readonly CliReferenceCommand[] | — | Commands: name, usage, description, optionGroups, examples, notes, help. |
examples | readonly CliReferenceExample[] | — | Page-level examples (their own section after the synopsis). |
codeMaxHeight | { help?: number | string; output?: number | string } | — | Collapse long output: output (examples), help (recorded help). Unset: never collapse. |
description | ReactNode | — | Shown in the synopsis section above the usage lines. |
labels | Partial<Record<CliReferenceLabel, ReactNode>> | — | Override catalog labels. |
navigationLabel | string | — | Accessible name of the section navigation (default from AnchorNav). |
notice | ReactNode | — | Shown above the synopsis (e.g. an Alert about a pre-release). |
prompt | string | $ | Prompt shown before each example command (default $); never copied. |
commandsrequiredreadonly CliReferenceCommand[]
Commands: name, usage, description, optionGroups, examples, notes, help.
examplesreadonly CliReferenceExample[]
Page-level examples (their own section after the synopsis).
codeMaxHeight{ help?: number | string; output?: number | string }
Collapse long output: output (examples), help (recorded help). Unset: never collapse.
descriptionReactNode
Shown in the synopsis section above the usage lines.
labelsPartial<Record<CliReferenceLabel, ReactNode>>
Override catalog labels.
navigationLabelstring
Accessible name of the section navigation (default from AnchorNav).
noticeReactNode
Shown above the synopsis (e.g. an Alert about a pre-release).
promptdefault $string
Prompt shown before each example command (default $); never copied.
Other props are passed to the root element (HTMLAttributes<HTMLDivElement>), including className, style, id and aria-* attributes.
plot [options] [file]Usage$ plot data.csv
▁▂▃▅▇█▇▅Basic chartplotDraws a chart from CSV rows. Reads stdin when no file is given.
plot [options] [file]Usage: plotfile-w, --width <columns>80--color--type <kind>$ plot --width 40 data.csv
▁▂▃▅▇Narrow chartNO_COLOR is set.Usage: plot [options] [file]
-w, --width <columns> chart width (default: 80)
--color colour outputplot --helpimport { CliReference, type CliReferenceCommand } from "@pixxl-tools/components";
const commands: CliReferenceCommand[] = [
{
name: "plot",
usage: "plot [options] [file]",
description: "Draws a chart from CSV rows. Reads `stdin` when no file is given.",
optionGroups: [
{ id: "arguments", title: "Arguments", options: [{ name: "file", description: "CSV file to read." }] },
{
id: "options",
title: "Options",
options: [
{ flags: ["-w", "--width"], value: "<columns>", defaultValue: "80", description: "Chart width in columns." },
{ flags: ["--color"], description: "Colour the output." },
],
},
],
examples: [{ id: "width", title: "Narrow chart", command: "plot --width 40 data.csv", output: "▁▂▃▅▇" }],
help: "Usage: plot [options] [file]",
},
];
<CliReference commands={commands} examples={[{ id: "basic", title: "Basic chart", command: "plot data.csv", output: "▁▂▃▅▇█▇▅" }]} />