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@v0.24.0/command/command.ts";

Add new sub-command.

Type Parameters

C extends Command<G | void | undefined, T | void | undefined, Record<string, any> | void, Array<unknown>, Record<string, any> | void, Record<string, any> | void, Record<string, any> | void, OneOf<CP, this> | undefined>
G extends (CP extends Command<any> ? CPG : Merge<CPG, CG>)
T extends (CP extends Command<any> ? CPT : Merge<CPT, CT>)

Parameters

name: string

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

cmd: C

The new child command to register.

optional
override: boolean

Override existing child command.

Returns

C extends Command<any, any, infer Options, infer Arguments, infer GlobalOptions, infer Types, infer GlobalTypes, any> ? Command<G, T, Options, Arguments, GlobalOptions, Types, GlobalTypes, OneOf<CP, this>> : never

Add new sub-command.

Type Parameters

N extends string
A extends TypedCommandArguments<N, CP extends Command<any> ? CPT : Merge<CPT, CGT>>

Parameters

name: N

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

CPG extends number ? Command<any> : Command<CP extends Command<any> ? CPG : Merge<CPG, CG>, CP extends Command<any> ? CPT : Merge<CPT, CGT>, void, A, void, void, void, OneOf<CP, this>>