Skip to content

gunshi / default / CommandContext

Interface: CommandContext<A, V>

Command context. Command context is the context of the command execution.

Type Parameters

Type ParameterDefault type
A extends ArgsArgs
VArgValues<A>

Properties

PropertyTypeDescription
_string[]Original command line arguments. This argument is passed from cli function.
argsACommand arguments, that is the arguments of the command that is executed. The command arguments is same Command.args.
descriptionundefined | stringCommand description, that is the description of the command that is executed. The command description is same CommandEnvironment.description.
envReadonly<CommandEnvironment<A>>Command environment, that is the environment of the command that is executed. The command environment is same CommandEnvironment.
loadCommands() => Promise<Command<A>[]>Load sub-commands. The loaded commands are cached and returned when called again.
localeLocaleCommand locale, that is the locale of the command that is executed.
log(message?, ...optionalParams) => voidOutput a message. If CommandEnvironment.usageSilent is true, the message is not output. See - console.log - console.log
nameundefined | stringCommand name, that is the command that is executed. The command name is same CommandEnvironment.name.
omittedbooleanWhether the currently executing command has been executed with the sub-command name omitted.
positionalsstring[]Command positionals arguments, that is the positionals of the command that is executed. Resolve positionals with resolveArgs from command arguments.
reststring[]Command rest arguments, that is the remaining argument not resolved by the optional command option delimiter --.
tokensArgToken[]Argument tokens, that is parsed by parseArgs function.
translate<T, O, K>(key, values?) => stringTranslate function.
valuesVCommand values, that is the values of the command that is executed. Resolve values with resolveArgs from command arguments and Command.args.

Released under the MIT License.