HelpDoc
Structured help documentation model for the unstable CLI package. A HelpDoc value captures the user-facing parts of a command, including its description, usage string, positional arguments, flags, global flags, subcommands, annotations, and examples.
This module only defines the data shapes used to describe help. Rendering that data as terminal text is handled by CliOutput.
Models
Signature
interface ArgDoc {
readonly description: Option<string>;
readonly name: string;
readonly required: boolean;
readonly type: string;
readonly variadic: boolean;
}ExampleDoc interface
Added in v4.0.0
Source
Documentation for a command usage example
Signature
interface ExampleDoc {
readonly command: string;
readonly description?: string;
}Documentation for a single command-line flag/option
Signature
interface FlagDoc {
readonly aliases: readonly Array<string>;
readonly description: Option<string>;
readonly name: string;
readonly required: boolean;
readonly type: string;
}Structured representation of help documentation for a command. This data structure is independent of formatting, allowing for different output formats (text, markdown, JSON, etc.).
Signature
interface HelpDoc {
readonly annotations: Context<never>;
readonly args?: readonly Array<ArgDoc>;
readonly description: string;
readonly examples?: readonly Array<ExampleDoc>;
readonly flags: readonly Array<FlagDoc>;
readonly globalFlags?: readonly Array<FlagDoc>;
readonly subcommands?: readonly Array<SubcommandGroupDoc>;
readonly usage: string;
}SubcommandDoc interface
Added in v4.0.0
Source
Documentation for a subcommand
Signature
interface SubcommandDoc {
readonly alias: string | undefined;
readonly description: string;
readonly name: string;
readonly shortDescription: string | undefined;
}SubcommandGroupDoc interface
Added in v4.0.0
Source
Documentation for a grouped subcommand listing
Signature
interface SubcommandGroupDoc {
readonly commands: readonly [SubcommandDoc, SubcommandDoc];
readonly group: string | undefined;
}
Documentation for a positional argument