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

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

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

Add new environment variable.

Type Parameters

N extends string
G extends TypedEnv<N, P, TCommandOptions, Merge<TParentCommandTypes, Merge<TCommandGlobalTypes, TCommandTypes>>, R>
MG extends MapValue<G, V>
optional
R extends EnvVarOptions["required"] = undefined
optional
P extends EnvVarOptions["prefix"] = undefined
optional
V = undefined

Parameters

name: N

Name of the environment variable.

description: string

The description of the environment variable.

options: Omit<EnvVarOptions, "value"> & { global: true; required?: R; prefix?: P; value?: EnvVarValueHandler<MapTypes<ValueOf<G>>, V>; }

Environment variable options.

Returns

Command<TParentCommandGlobals, TParentCommandTypes, TCommandOptions, TCommandArguments, Merge<TCommandGlobals, MG>, TCommandTypes, TCommandGlobalTypes, TParentCommand>

Type Parameters

TNameAndValue extends string
TEnvVar extends TypedEnv<TNameAndValue, TPrefix, TCommandOptions, Merge<TParentCommandTypes, Merge<TCommandGlobalTypes, TCommandTypes>>, TRequired>
TMappedEnvVar extends MapValue<TEnvVar, TMappedValue>
optional
TRequired extends EnvVarOptions["required"] = undefined
optional
TPrefix extends EnvVarOptions["prefix"] = undefined
optional
TMappedValue = undefined

Parameters

description: string
optional
options: Omit<EnvVarOptions, "value"> & { required?: TRequired; prefix?: TPrefix; value?: EnvVarValueHandler<MapTypes<ValueOf<TEnvVar>>, TMappedValue>; }

Returns

Command<TParentCommandGlobals, TParentCommandTypes, Merge<TCommandOptions, TMappedEnvVar>, TCommandArguments, TCommandGlobals, TCommandTypes, TCommandGlobalTypes, TParentCommand>