Skip to content

CommandDefinition

Input shape accepted by createCommandSchema.

Every field except name is optional. Flags, args, and subcommands accept either definitions or already-built schemas.

Signatures

ts
interface CommandDefinition {}

Members

Properties

aliases

Alternative names for this command.

ts
aliases?: readonly string[];

args

Ordered positional arg entries.

ts
args?: readonly CommandArgEntryDefinition[];

commands

Nested subcommand definitions or built schemas.

ts
commands?: readonly (CommandSchema | CommandDefinition)[];

description

Human-readable description for help text.

ts
description?: string;

examples

Usage examples for help text.

ts
examples?: readonly CommandExample[];

flags

Flag definitions or built schemas, keyed by flag name.

ts
flags?: Readonly<Record<string, FlagSchema<"string" | "number" | "boolean" | "enum" | "array" | "custom" | "count" | "keyValue"> | FlagDefinition>>;

hasAction

Whether an action handler has been registered.

ts
hasAction?: boolean;

hidden

Whether this command is hidden from help listings.

ts
hidden?: boolean;

interactive

Command-level interactive resolver.

ts
interactive?: ErasedInteractiveResolver;

name

The command name used for dispatch.

ts
name: string;

See Also

Released under the MIT License.