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 ​

name ​

The command name used for dispatch.

ts
name: string;

description ​

Human-readable description for help text.

ts
description?: string | undefined;

details ​

Longer explanation shown only in this command's help.

ts
details?: HelpDescription | undefined;

aliases ​

Alternative names for this command.

ts
aliases?: readonly string[] | undefined;

hidden ​

Whether this command is hidden from help listings.

ts
hidden?: boolean | undefined;

examples ​

Usage examples for help text.

ts
examples?: readonly CommandExample[] | undefined;

flags ​

Flag definitions or built schemas, keyed by flag name.

ts
flags?: Readonly<Record<string, FlagDefinition | FlagSchema>> | undefined;

flagDeclarationOrder ​

Explicit declaration order for named flags. Unlisted flags follow in record order.

ts
flagDeclarationOrder?: readonly string[] | undefined;

helpTopics ​

Text-help topic names mapped to flag group names.

ts
helpTopics?: Readonly<Record<string, string>> | undefined;

args ​

Ordered positional arg entries.

ts
args?: readonly CommandArgEntryDefinition[] | undefined;

constraints ​

Relationships checked after input resolution.

ts
constraints?: readonly CommandConstraint[] | undefined;

validators ​

Object validators run after resolution. @internal

ts
validators?: readonly CommandValidator[] | undefined;

hasAction ​

Whether an action handler has been registered.

ts
hasAction?: boolean | undefined;

interactive ​

Command-level interactive resolver.

ts
interactive?: ErasedInteractiveResolver | undefined;

commands ​

Nested subcommand definitions or built schemas.

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

See Also ​

Released under the MIT License.