Interface CommandModule<TData, TOptions, TReturn>

A command module that can be executed by the CLI engine.

interface CommandModule<
    TData = unknown,
    TOptions extends OptionsConfig = OptionsConfig,
    TReturn = unknown,
> {
    description?: string;
    handler: CommandHandler<TData, TOptions, TReturn>;
    isMiddleware?: boolean;
    options?: TOptions;
    requiresSubcommand?: boolean;
}

Type Parameters

  • TData = unknown

    The data type the handler expects to receive.

  • TOptions extends OptionsConfig = OptionsConfig

    The OptionsConfig type for the command.

  • TReturn = unknown

    The return type of the command handler.

Properties

description?: string

A description of the command that will be displayed in the help menu.

The command handler. This is where the command's logic is executed.

isMiddleware?: boolean

If true, the command will be executed before the next command in the chain.

true
options?: TOptions

The options config for the command.

requiresSubcommand?: boolean

If true, the command will require a subcommand to be executed.

false