gunshi / default / CommandEnvironment
Interface: CommandEnvironment<G>
Command environment.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
G extends GunshiParamsConstraint | DefaultGunshiParams | A type extending GunshiParams to specify the shape of command environments. |
Properties
| Property | Type | Description |
|---|---|---|
cwd | undefined | string | Current working directory. See CliOptions.cwd |
description | undefined | string | Command description. See CliOptions.description |
leftMargin | number | Left margin of the command output. Default 2 See CliOptions.leftMargin |
middleMargin | number | Middle margin of the command output. Default 10 See CliOptions.middleMargin |
name | undefined | string | Command name. See CliOptions.name |
onAfterCommand | | undefined | (ctx, result) => Awaitable<void> | Hook that runs after successful command execution See CliOptions.onAfterCommand Since v0.27.0 |
onBeforeCommand | | undefined | (ctx) => Awaitable<void> | Hook that runs before any command execution See CliOptions.onBeforeCommand Since v0.27.0 |
onErrorCommand | | undefined | (ctx, error) => Awaitable<void> | Hook that runs when a command throws an error See CliOptions.onErrorCommand Since v0.27.0 |
renderHeader | undefined | null | (ctx) => Promise<string> | Render function the header section in the command usage. |
renderUsage | undefined | null | (ctx) => Promise<string> | Render function the command usage. |
renderValidationErrors | undefined | null | (ctx, error) => Promise<string> | Render function the validation errors. |
subCommands | | undefined | Map<string, | Command<any> | LazyCommand<any, { }>> | Sub commands. See CliOptions.subCommands |
usageOptionType | boolean | Whether to display the usage option type. Default false See CliOptions.usageOptionType |
usageOptionValue | boolean | Whether to display the option value. Default true See CliOptions.usageOptionValue |
usageSilent | boolean | Whether to display the command usage. Default false See CliOptions.usageSilent |
version | undefined | string | Command version. See CliOptions.version |
