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

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

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

Add a new option.

Type Parameters

F extends string
G extends TypedOption<F, CO, Merge<CPT, Merge<CGT, CT>>, R, D>
MG extends MapValue<G, V, C>
optional
R extends ICommandOption["required"] = undefined
optional
C extends ICommandOption["collect"] = undefined
optional
D = undefined
optional
V = undefined

Parameters

flags: F

Flags string e.g: -h, --help, --manual requiredArg:string [optionalArg:number] [...restArgs:string]

desc: string

Flag description.

opts: Omit<ICommandOption<Partial<CO>, CA, MergeOptions<F, CG, G>, CPG, CT, CGT, CPT, CP>, "value"> & { global: true; default?: IDefaultValue<D>; required?: R; collect?: C; value?: IFlagValueHandler<MapTypes<ValueOf<G>>, V>; } | IFlagValueHandler<MapTypes<ValueOf<G>>, V>

Flag options or custom handler for processing flag value.

Returns

Command<CPG, CPT, CO, CA, MergeOptions<F, CG, MG>, CT, CGT, CP>

Type Parameters

F extends string
O extends TypedOption<F, CO, Merge<CPT, Merge<CGT, CT>>, R, D>
MO extends MapValue<O, V, C>
optional
R extends ICommandOption["required"] = undefined
optional
C extends ICommandOption["collect"] = undefined
optional
D = undefined
optional
V = undefined

Parameters

flags: F
desc: string
optional
opts: Omit<ICommandOption<MergeOptions<F, CO, O>, CA, CG, CPG, CT, CGT, CPT, CP>, "value"> & { default?: IDefaultValue<D>; required?: R; collect?: C; value?: IFlagValueHandler<MapTypes<ValueOf<O>>, V>; } | IFlagValueHandler<MapTypes<ValueOf<O>>, V>

Returns

Command<CPG, CPT, MergeOptions<F, CO, MO>, CA, CG, CT, CGT, CP>