apiref
tkt@2.0.2

ICli.command()  MethodSignature

Register a command.

Signature

command<LocalOptions extends {
        [key: string]: yargs.Options;
    }>(command: string | ReadonlyArray<string>, description: string, options: LocalOptions, handler: (args: CliArguments<LocalOptions>) => void): ICli<GlobalOptions>;

Parameters

ParameterTypeDescription
commandstring | ReadonlyArray<string>

The command string. Use $0 for default command. Add <arg> for required positional parameter. Add [arg] for optional positional parameter. See yargs Command API documentation for details.

descriptionstring

The command description, the text to show in --help menu.

optionsLocalOptions

The options accepted by the command. See yargs API documentation for details.

handler(args: CliArguments<LocalOptions>) => void

The command handler. It may return a promise. If the promise is rejected, the CLI will exit with the help text and a non-zero code.

(Returns)ICli<GlobalOptions>

An instance of ICli for chaining.