gunshi / default / CommandContext
Interface: CommandContext<Options, Values>
Command context. Command context is the context of the command execution.
Type Parameters
| Type Parameter | Default type |
|---|---|
Options extends ArgOptions | ArgOptions |
Values | ArgValues<Options> |
Properties
| Property | Type | Description |
|---|---|---|
_ | string[] | Original command line arguments. This argument is passed from cli function. |
description | undefined | string | Command description, that is the description of the command that is executed. The command description is same CommandEnvironment.description. |
env | Readonly<CommandEnvironment<Options>> | Command environment, that is the environment of the command that is executed. The command environment is same CommandEnvironment. |
loadCommands | () => Promise<Command<Options>[]> | Load sub-commands. The loaded commands are cached and returned when called again. |
locale | Locale | Command locale, that is the locale of the command that is executed. |
log | (message?, ...optionalParams) => void | Output a message. If CommandEnvironment.usageSilent is true, the message is not output. See - console.log - console.log |
name | undefined | string | Command name, that is the command that is executed. The command name is same CommandEnvironment.name. |
omitted | boolean | Whether the currently executing command has been executed with the sub-command name omitted. |
options | Options | Command options, that is the options of the command that is executed. The command options is same Command.options. |
positionals | string[] | Command positionals arguments, that is the positionals of the command that is executed. Resolve positionals with resolveArgs from command arguments. |
tokens | ArgToken[] | Argument tokens, that is parsed by parseArgs function. |
translate | <T, O, Key>(key, values?) => string | Translate function. |
values | Values | Command values, that is the values of the command that is executed. Resolve values with resolveArgs from command arguments and Command.options. |
