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@v1.0.0-rc.2/command/mod.ts";

Register a global 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>

Register an environment variable.

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

Name of the environment variable.

description: string

The description of the environment variable.

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

Environment variable options.

Returns

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