Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/cliffy/command/command.ts>Command#command

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Go to Latest
method Command.prototype.command
import { Command } from "https://deno.land/x/cliffy@v1.0.0-rc.2/command/command.ts";

Add new sub-command.

Type Parameters

TCommand extends Command<(TGlobalOptions & Record<string, unknown>) | void | undefined, TGlobalTypes | void | undefined, Record<string, unknown> | void, Array<unknown>, Record<string, unknown> | void, Record<string, unknown> | void, Record<string, unknown> | void, Command<TGlobalOptions | void | undefined, TGlobalTypes | void | undefined, Record<string, unknown> | void, Array<unknown>, Record<string, unknown> | void, Record<string, unknown> | void, Record<string, unknown> | void, undefined>>
TGlobalOptions extends (TParentCommand extends Command<any> ? TParentCommandGlobals : Merge<TParentCommandGlobals, TCommandGlobals>)
TGlobalTypes extends (TParentCommand extends Command<any> ? TParentCommandTypes : Merge<TParentCommandTypes, TCommandTypes>)

Parameters

name: string

Command definition. E.g: my-command <input-file:string> <output-file:string>

The new child command to register.

optional
override: boolean

Override existing child command.

Returns

ReturnType<TCommand["reset"]> extends Command<Record<string, unknown> | void, Record<string, unknown> | void, infer Options, infer Arguments, infer GlobalOptions, infer Types, infer GlobalTypes, undefined> ? Command<TGlobalOptions, TGlobalTypes, Options, Arguments, GlobalOptions, Types, GlobalTypes, OneOf<TParentCommand, this>> : never

Add new sub-command.

Type Parameters

TCommand extends Command<TGlobalOptions | void | undefined, TGlobalTypes | void | undefined, Record<string, unknown> | void, Array<unknown>, Record<string, unknown> | void, Record<string, unknown> | void, Record<string, unknown> | void, OneOf<TParentCommand, this> | undefined>
TGlobalOptions extends (TParentCommand extends Command<any> ? TParentCommandGlobals : Merge<TParentCommandGlobals, TCommandGlobals>)
TGlobalTypes extends (TParentCommand extends Command<any> ? TParentCommandTypes : Merge<TParentCommandTypes, TCommandTypes>)

Parameters

name: string

Command definition. E.g: my-command <input-file:string> <output-file:string>

The new child command to register.

optional
override: boolean

Override existing child command.

Returns

TCommand extends Command<Record<string, unknown> | void, Record<string, unknown> | void, infer Options, infer Arguments, infer GlobalOptions, infer Types, infer GlobalTypes, OneOf<TParentCommand, this> | undefined> ? Command<TGlobalOptions, TGlobalTypes, Options, Arguments, GlobalOptions, Types, GlobalTypes, OneOf<TParentCommand, this>> : never

Add new sub-command.

Type Parameters

TNameAndArguments extends string
TArguments extends TypedCommandArguments<TNameAndArguments, TParentCommand extends Command<any> ? TParentCommandTypes : Merge<TParentCommandTypes, TCommandGlobalTypes>>

Parameters

nameAndArguments: TNameAndArguments

Command definition. E.g: my-command <input-file:string> <output-file:string>

optional
desc: string

The description of the new child command.

optional
override: boolean

Override existing child command.

Returns

TParentCommandGlobals extends number ? Command<any> : Command<TParentCommand extends Command<any> ? TParentCommandGlobals : Merge<TParentCommandGlobals, TCommandGlobals>, TParentCommand extends Command<any> ? TParentCommandTypes : Merge<TParentCommandTypes, TCommandGlobalTypes>, void, TArguments, void, void, void, OneOf<TParentCommand, this>>