env

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package env implements command-line environment variables parsing.

Usage

Define env vars using env.String, Bool, Int, etc.

This declares an integer env variable, N, stored in the pointer nEnvVar, with type *int:

import "github.com/negrel/configue/env"
var nEnvVar = env.Int("N", 1234, "help message for env var N")

If you like, you can bind the env var to a variable using the Var() functions.

var envVar int
func init() {
	env.IntVar(&envVar, "ENVNAME", 1234, "help message for ENVNAME")
}

Or you can create custom env vars that satisfy the Value interface (with pointer receivers) and couple them to env var parsing by

env.Var(&envVar, "ENVNAME", "help message for ENVNAME")

For such env vars, the default value is just the initial value of the variable.

After all env vars are defined, call

env.Parse()

to parse the command line into the defined env vars.

Env vars may then be used directly. If you're using the env vars themselves, they are all pointers; if you bind to variables, they're values.

fmt.Println("ip has value ", *ip)
fmt.Println("envVar has value ", envVar)

Command line env var syntax

See [`option`](../option#pkg-overview) documentation for options syntax of basic types.

The default set of command-line env vars is controlled by top-level functions. The EnvSet type allows one to define independent sets of env vars, such as to implement subcommands in a command-line interface. The methods of EnvSet are analogous to the top-level functions for the command-line env var set.

Index

Constants

View Source
const (
	ContinueOnError ErrorHandling = flag.ContinueOnError // Return a descriptive error.
	ExitOnError                   = flag.ExitOnError     // Call os.Exit(2).
	PanicOnError                  = flag.PanicOnError    // Call panic with a descriptive error.
)

These constants cause EnvSet.Parse to behave as described if the parse fails.

Variables

View Source
var (
	// CommandLine is the default set of command-line env vars, parsed from
	// os.Environ. The top-level functions such as BoolVar, and so on are
	// wrappers for the methods of CommandLine.
	CommandLine = NewEnvSet("", ExitOnError)
	// Usage prints a usage message documenting all defined command-line env vars
	//  to CommandLine's output, which by default is os.Stderr. It is called when
	// an error occurs while parsing env vars. The function is a variable that may
	// be changed to point to a custom function. By default it prints a simple
	// header and calls PrintDefaults; for details about the format of the Output
	// and how to control it, see the documentation for PrintDefaults. Custom
	// usage functions may choose to exit the program; by default exiting happens
	// anyway as the command line's error handling strategy is set to ExitOnError.
	Usage = func() {
		_, _ = fmt.Fprintf(CommandLine.Output(), "Usage of %s:\n", os.Args[0])
		PrintDefaults()
	}
	// Ignore undefined variables instead of returning error.
	IgnoreUndefined = true
)

Functions

func Bool

func Bool(name string, value bool, usage string) *bool

Bool defines a bool env var with specified name, default value, and usage string. The return value is the address of a bool variable that stores the value of the env var.

func BoolSlice added in v0.5.0

func BoolSlice(name string, value []bool, usage string) *[]bool

BoolSlice defines a slice of bool env var with specified name, default value, and usage string. The return value is the address of a slice of bool variable that stores the value of the env var.

func BoolSliceVar added in v0.5.0

func BoolSliceVar(p *[]bool, name string, value []bool, usage string)

BoolSliceVar defines a slice of bool env var with specified name, default value, and usage string. The argument p points to a slice of bool variable in which to store the value of the env var.

func BoolVar

func BoolVar(p *bool, name string, value bool, usage string)

BoolVar defines a bool env var with specified name, default value, and usage string. The argument p points to a bool variable in which to store the value of the env var.

func Duration

func Duration(name string, value time.Duration, usage string) *time.Duration

Duration defines a time.Duration env var with specified name, default value, and usage string. The return value is the address of a time.Duration variable that stores the value of the env var.

func DurationSlice added in v0.5.0

func DurationSlice(name string, value []time.Duration, usage string) *[]time.Duration

DurationSlice defines a slice of time.Duration env var with specified name, default value, and usage string. The return value is the address of a slice of time.Duration variable that stores the value of the env var.

func DurationSliceVar added in v0.5.0

func DurationSliceVar(p *[]time.Duration, name string, value []time.Duration, usage string)

DurationSliceVar defines a slice of time.Duration env var with specified name, default value, and usage string. The argument p points to a slice of time.Duration variable in which to store the value of the env var.

func DurationVar

func DurationVar(p *time.Duration, name string, value time.Duration, usage string)

DurationVar defines a time.Duration env var with specified name, default value, and usage string. The argument p points to a time.Duration variable in which to store the value of the env var.

func Float64

func Float64(name string, value float64, usage string) *float64

Float64 defines a float64 env var with specified name, default value, and usage string. The return value is the address of a float64 variable that stores the value of the env var.

func Float64Slice added in v0.5.0

func Float64Slice(name string, value []float64, usage string) *[]float64

Float64Slice defines a slice of float64 env var with specified name, default value, and usage string. The return value is the address of a slice of float64 variable that stores the value of the env var.

func Float64SliceVar added in v0.5.0

func Float64SliceVar(p *[]float64, name string, value []float64, usage string)

Float64SliceVar defines a slice of float64 env var with specified name, default value, and usage string. The argument p points to a slice of float64 variable in which to store the value of the env var.

func Float64Var

func Float64Var(p *float64, name string, value float64, usage string)

Float64Var defines a float64 env var with specified name, default value, and usage string. The argument p points to a float64 variable in which to store the value of the env var.

func Func added in v0.5.0

func Func(name, usage string, fn func(string) error)

Func defines an env var with the specified name and usage string. Each time the env var is seen, fn is called with the value of the env var. If fn returns a non-nil error, it will be treated as a value parsing error.

func Int

func Int(name string, value int, usage string) *int

Int defines an int env var with specified name, default value, and usage string. The return value is the address of an int variable that stores the value of the env var.

func Int64

func Int64(name string, value int64, usage string) *int64

Int64 defines an int64 env var with specified name, default value, and usage string. The return value is the address of an int64 variable that stores the value of the env var.

func Int64Slice added in v0.5.0

func Int64Slice(name string, value []int64, usage string) *[]int64

Int64Slice defines a slice of int64 env var with specified name, default value, and usage string. The return value is the address of a slice of int64 variable that stores the value of the env var.

func Int64SliceVar added in v0.5.0

func Int64SliceVar(p *[]int64, name string, value []int64, usage string)

Int64SliceVar defines a slice of int64 env var with specified name, default value, and usage string. The argument p points to a slice of int64 variable in which to store the value of the env var.

func Int64Var

func Int64Var(p *int64, name string, value int64, usage string)

Int64Var defines an int64 env var with specified name, default value, and usage string. The argument p points to an int64 variable in which to store the value of the env var.

func IntSlice added in v0.5.0

func IntSlice(name string, value []int, usage string) *[]int

IntSlice defines a slice of int env var with specified name, default value, and usage string. The return value is the address of a slice of int variable that stores the value of the env var.

func IntSliceVar added in v0.5.0

func IntSliceVar(p *[]int, name string, value []int, usage string)

IntSliceVar defines a slice of int env var with specified name, default value, and usage string. The argument p points to a slice of int variable in which to store the value of the env var.

func IntVar

func IntVar(p *int, name string, value int, usage string)

IntVar defines an int env var with specified name, default value, and usage string. The argument p points to an int variable in which to store the value of the env var.

func Parse

func Parse() error

Parse parses the command-line env vars from os.Environ(). Must be called after all env vars are defined and before env vars are accessed by the program.

func Parsed

func Parsed() bool

Parsed reports whether the command-line env vars have been parsed.

func PrintDefaults

func PrintDefaults()

PrintDefaults prints, to standard error unless configured otherwise, a usage message showing the default settings of all defined env vars.

See the documentation *EnvSet.PrintDefaults for more information.

To change the destination for env var messages, call CommandLine.SetOutput.

func Set

func Set(name, value string) error

Set sets the value of the named command-line env var.

func String

func String(name string, value string, usage string) *string

String defines a string env var with specified name, default value, and usage string. The return value is the address of a string variable that stores the value of the env var.

func StringSlice added in v0.5.0

func StringSlice(name string, value []string, usage string) *[]string

StringSlice defines a slice of string env var with specified name, default value, and usage string. The return value is the address of a slice of string variable that stores the value of the env var.

func StringSliceVar added in v0.5.0

func StringSliceVar(p *[]string, name string, value []string, usage string)

StringSliceVar defines a slice of string env var with specified name, default value, and usage string. The argument p points to a slice of string variable in which to store the value of the env var.

func StringVar

func StringVar(p *string, name string, value string, usage string)

StringVar defines a string env var with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the env var.

func TextVar

func TextVar(
	p encoding.TextUnmarshaler,
	name string,
	value encoding.TextMarshaler,
	usage string,
)

TextVar defines an env var with a specified name, default value, and usage string. The argument p must be a pointer to a variable that will hold the value of the env var, and p must implement encoding.TextUnmarshaler. If the env var is used, the env var value will be passed to p's UnmarshalText method. The type of the default value must be the same as the type of p.

func Uint

func Uint(name string, value uint, usage string) *uint

Uint defines an uint env var with specified name, default value, and usage string. The return value is the address of an uint variable that stores the value of the env var.

func Uint64

func Uint64(name string, value uint64, usage string) *uint64

Uint64 defines an uint64 env var with specified name, default value, and usage string. The return value is the address of an uint64 variable that stores the value of the env var.

func Uint64Slice added in v0.5.0

func Uint64Slice(name string, value []uint64, usage string) *[]uint64

Uint64Slice defines a slice of uint64 env var with specified name, default value, and usage string. The return value is the address of a slice of uint64 variable that stores the value of the env var.

func Uint64SliceVar added in v0.5.0

func Uint64SliceVar(p *[]uint64, name string, value []uint64, usage string)

Uint64SliceVar defines a slice of uint64 env var with specified name, default value, and usage string. The argument p points to a slice of uint64 variable in which to store the value of the env var.

func Uint64Var

func Uint64Var(p *uint64, name string, value uint64, usage string)

Uint64Var defines an uint64 env var with specified name, default value, and usage string. The argument p points to an uint64 variable in which to store the value of the env var.

func UintSlice added in v0.5.0

func UintSlice(name string, value []uint, usage string) *[]uint

UintSlice defines a slice of uint env var with specified name, default value, and usage string. The return value is the address of a slice of uint variable that stores the value of the env var.

func UintSliceVar added in v0.5.0

func UintSliceVar(p *[]uint, name string, value []uint, usage string)

UintSliceVar defines a slice of uint env var with specified name, default value, and usage string. The argument p points to a slice of uint variable in which to store the value of the env var.

func UintVar

func UintVar(p *uint, name string, value uint, usage string)

UintVar defines an uint env var with specified name, default value, and usage string. The argument p points to an uint variable in which to store the value of the env var.

func UnquoteUsage

func UnquoteUsage(optValue option.Value, optUsage string) (name string, usage string)

UnquoteUsage extracts a back-quoted name from the usage string for an env var and returns it and the un-quoted usage. Given "a `name` to show" it returns ("name", "a name to show"). If there are no back quotes, the name is an educated guess of the type of the env var's value, or the empty string if the env var is boolean.

func Var

func Var(value option.Value, name string, usage string)

Var defines an env var with the specified name and usage string. The type and value of the env var are represented by the first argument, of type [Value], which typically holds a user-defined implementation of [Value]. For instance, the caller could create an env var that turns a comma-separated string into a slice of strings by giving the slice the methods of [Value]; in particular, Set would decompose the comma-separated string into the slice.

func Visit

func Visit(fn func(*EnvVar))

Visit visits the command-line env vars in lexicographical order, calling fn for each. It visits only those env vars that have been set.

func VisitAll

func VisitAll(fn func(*EnvVar))

VisitAll visits the command-line env vars in lexicographical order, calling fn for each. It visits all env vars, even those not set.

Types

type EnvSet

type EnvSet struct {
	Usage func()
	// contains filtered or unexported fields
}

EnvSet represents a set of defined environment variables. The zero value of a EnvSet has no name and has ContinueOnError error handling.

EnvVar names must be unique within a EnvSet. An attempt to define an env var whose name is already in use will cause a panic.

func NewEnvSet

func NewEnvSet(name string, errorHandling ErrorHandling) *EnvSet

NewEnvSet returns a new, empty env var set with the specified name and error handling property. If the name is not empty, it will be printed in the default usage message and in error messages.

func (*EnvSet) Bool

func (es *EnvSet) Bool(
	name string,
	value bool,
	usage string,
) *bool

Bool defines a bool option with specified name, default value, and usage string. The return value is the address of a bool variable that stores the value of the option.

func (*EnvSet) BoolSlice added in v0.5.0

func (es *EnvSet) BoolSlice(
	name string,
	value []bool,
	usage string,
) *[]bool

Bool defines a slice of bool option with specified name, default value, and usage string. The return value is the address of a slice of bool variable that stores the value of the option.

func (*EnvSet) BoolSliceVar added in v0.5.0

func (es *EnvSet) BoolSliceVar(
	p *[]bool,
	name string,
	value []bool,
	usage string,
)

BoolSliceVar defines a slice of bool option with specified name, default value, and usage string. The argument p points to a slice of bool variable in which to store the value of the option.

func (*EnvSet) BoolVar

func (es *EnvSet) BoolVar(
	p *bool,
	name string,
	value bool,
	usage string,
)

Bool defines a bool option with specified name, default value, and usage string. The argument p points to a bool variable in which to store the value of the option.

func (*EnvSet) Duration

func (es *EnvSet) Duration(
	name string,
	value time.Duration,
	usage string,
) *time.Duration

Duration defines a time.Duration option with specified name, default value, and usage string. The return value is the address of a time.Duration variable that stores the value of the option.

func (*EnvSet) DurationSlice added in v0.5.0

func (es *EnvSet) DurationSlice(
	name string,
	value []time.Duration,
	usage string,
) *[]time.Duration

Duration defines a slice of time.Duration option with specified name, default value, and usage string. The return value is the address of a slice of time.Duration variable that stores the value of the option.

func (*EnvSet) DurationSliceVar added in v0.5.0

func (es *EnvSet) DurationSliceVar(
	p *[]time.Duration,
	name string,
	value []time.Duration,
	usage string,
)

DurationSliceVar defines a slice of time.Duration option with specified name, default value, and usage string. The argument p points to a slice of time.Duration variable in which to store the value of the option.

func (*EnvSet) DurationVar

func (es *EnvSet) DurationVar(
	p *time.Duration,
	name string,
	value time.Duration,
	usage string,
)

Duration defines a time.Duration option with specified name, default value, and usage string. The argument p points to a time.Duration variable in which to store the value of the option.

func (*EnvSet) Float64

func (es *EnvSet) Float64(
	name string,
	value float64,
	usage string,
) *float64

Float64 defines a float64 option with specified name, default value, and usage string. The return value is the address of a float64 variable that stores the value of the option.

func (*EnvSet) Float64Slice added in v0.5.0

func (es *EnvSet) Float64Slice(
	name string,
	value []float64,
	usage string,
) *[]float64

Float64 defines a slice of float64 option with specified name, default value, and usage string. The return value is the address of a slice of float64 variable that stores the value of the option.

func (*EnvSet) Float64SliceVar added in v0.5.0

func (es *EnvSet) Float64SliceVar(
	p *[]float64,
	name string,
	value []float64,
	usage string,
)

Float64SliceVar defines a slice of float64 option with specified name, default value, and usage string. The argument p points to a slice of float64 variable in which to store the value of the option.

func (*EnvSet) Float64Var

func (es *EnvSet) Float64Var(
	p *float64,
	name string,
	value float64,
	usage string,
)

Float64 defines a float64 option with specified name, default value, and usage string. The argument p points to a float64 variable in which to store the value of the option.

func (*EnvSet) Func added in v0.5.0

func (es *EnvSet) Func(name, usage string, fn func(string) error)

Func defines an env var with the specified name and usage string. Each time the env var is seen, fn is called with the value of the env var. If fn returns a non-nil error, it will be treated as a value parsing error.

func (*EnvSet) Init

func (es *EnvSet) Init(name string, errorHandling ErrorHandling)

Init sets the name and error handling property for a env var set. By default, the zero EnvSet uses an empty name and the ContinueOnError error handling policy.

func (*EnvSet) Int

func (es *EnvSet) Int(
	name string,
	value int,
	usage string,
) *int

Int defines an int option with specified name, default value, and usage string. The return value is the address of an int variable that stores the value of the option.

func (*EnvSet) Int64

func (es *EnvSet) Int64(
	name string,
	value int64,
	usage string,
) *int64

Int64 defines an int64 option with specified name, default value, and usage string. The return value is the address of an int64 variable that stores the value of the option.

func (*EnvSet) Int64Slice added in v0.5.0

func (es *EnvSet) Int64Slice(
	name string,
	value []int64,
	usage string,
) *[]int64

Int64 defines a slice of int64 option with specified name, default value, and usage string. The return value is the address of a slice of int64 variable that stores the value of the option.

func (*EnvSet) Int64SliceVar added in v0.5.0

func (es *EnvSet) Int64SliceVar(
	p *[]int64,
	name string,
	value []int64,
	usage string,
)

Int64SliceVar defines a slice of int64 option with specified name, default value, and usage string. The argument p points to a slice of int64 variable in which to store the value of the option.

func (*EnvSet) Int64Var

func (es *EnvSet) Int64Var(
	p *int64,
	name string,
	value int64,
	usage string,
)

Int64 defines an int64 option with specified name, default value, and usage string. The argument p points to a int64 variable in which to store the value of the option.

func (*EnvSet) IntSlice added in v0.5.0

func (es *EnvSet) IntSlice(
	name string,
	value []int,
	usage string,
) *[]int

Int defines a slice of int option with specified name, default value, and usage string. The return value is the address of a slice of int variable that stores the value of the option.

func (*EnvSet) IntSliceVar added in v0.5.0

func (es *EnvSet) IntSliceVar(
	p *[]int,
	name string,
	value []int,
	usage string,
)

IntSliceVar defines a slice of int option with specified name, default value, and usage string. The argument p points to a slice of int variable in which to store the value of the option.

func (*EnvSet) IntVar

func (es *EnvSet) IntVar(
	p *int,
	name string,
	value int,
	usage string,
)

Int defines an int option with specified name, default value, and usage string. The argument p points to a int variable in which to store the value of the option.

func (*EnvSet) Lookup

func (es *EnvSet) Lookup(name string) *EnvVar

Lookup returns the EnvVar structure of the named env var, returning nil if none exists.

func (*EnvSet) Name

func (es *EnvSet) Name() string

Name returns the name of the env set.

func (*EnvSet) Output

func (es *EnvSet) Output() io.Writer

Output returns the destination for usage and error messages. os.Stderr is returned if output was not set or was set to nil.

func (*EnvSet) Parse

func (es *EnvSet) Parse(envvars []string) error

Parse parses env var definitions from the environment variable list. Must be called after all env vars in the EnvSet are defined and before env vars are accessed by the program.

func (*EnvSet) Parsed

func (es *EnvSet) Parsed() bool

Parsed reports whether EnvSet.Parse has been called.

func (*EnvSet) PrintDefaults

func (es *EnvSet) PrintDefaults()

PrintDefaults prints, to standard error unless configured otherwise, the default values of all defined env vars in the set. For an integer valued env var X, the default output has the form

X int
	usage-message-for-x (default 7)

The usage message will appear on a separate line for anything but a bool env var with a one-byte name. For bool env vars, the type is omitted and if the env var name is one byte the usage message appears on the same line. The parenthetical default is omitted if the default is the zero value for the type. The listed type, here int, can be changed by placing a back-quoted name in the env var's usage string; the first such item in the message is taken to be a parameter name to show in the message and the back quotes are stripped from the message when displayed. For instance, given

env.String("I", "", "search `directory` for include files")

the output will be

I directory
	search directory for include files.

To change the destination for env var messages, call *EnvSet.SetOutput.

func (*EnvSet) Set

func (es *EnvSet) Set(name, value string) error

Set sets the value of the named command-line env var.

func (*EnvSet) SetOutput

func (es *EnvSet) SetOutput(output io.Writer)

SetOutput sets the destination for usage and error messages. If output is nil, os.Stderr is used.

func (*EnvSet) String

func (es *EnvSet) String(
	name string,
	value string,
	usage string,
) *string

String defines a string option with specified name, default value, and usage string. The return value is the address of a string variable that stores the value of the option.

func (*EnvSet) StringSlice added in v0.5.0

func (es *EnvSet) StringSlice(
	name string,
	value []string,
	usage string,
) *[]string

String defines a slice of string option with specified name, default value, and usage string. The return value is the address of a slice of string variable that stores the value of the option.

func (*EnvSet) StringSliceVar added in v0.5.0

func (es *EnvSet) StringSliceVar(
	p *[]string,
	name string,
	value []string,
	usage string,
)

StringSliceVar defines a slice of string option with specified name, default value, and usage string. The argument p points to a slice of string variable in which to store the value of the option.

func (*EnvSet) StringVar

func (es *EnvSet) StringVar(
	p *string,
	name string,
	value string,
	usage string,
)

String defines a string option with specified name, default value, and usage string. The argument p points to a string variable in which to store the value of the option.

func (*EnvSet) TextVar

func (es *EnvSet) TextVar(
	p encoding.TextUnmarshaler,
	name string,
	value encoding.TextMarshaler,
	usage string,
)

TextVar defines an option with a specified name, default value, and usage string. The argument p must be a pointer to a variable that will hold the value of the option, and p must implement encoding.TextUnmarshal. If the option is used, the option value will be passed to p's UnmarshalText method. The type of the default value must be the same as the type of p.

func (*EnvSet) Uint

func (es *EnvSet) Uint(
	name string,
	value uint,
	usage string,
) *uint

Uint defines an uint option with specified name, default value, and usage string. The return value is the address of an uint variable that stores the value of the option.

func (*EnvSet) Uint64

func (es *EnvSet) Uint64(
	name string,
	value uint64,
	usage string,
) *uint64

Uint64 defines an uint64 option with specified name, default value, and usage string. The return value is the address of an uint64 variable that stores the value of the option.

func (*EnvSet) Uint64Slice added in v0.5.0

func (es *EnvSet) Uint64Slice(
	name string,
	value []uint64,
	usage string,
) *[]uint64

Uint64 defines a slice of uint64 option with specified name, default value, and usage string. The return value is the address of a slice of uint64 variable that stores the value of the option.

func (*EnvSet) Uint64SliceVar added in v0.5.0

func (es *EnvSet) Uint64SliceVar(
	p *[]uint64,
	name string,
	value []uint64,
	usage string,
)

Uint64SliceVar defines a slice of uint64 option with specified name, default value, and usage string. The argument p points to a slice of uint64 variable in which to store the value of the option.

func (*EnvSet) Uint64Var

func (es *EnvSet) Uint64Var(
	p *uint64,
	name string,
	value uint64,
	usage string,
)

Uint64 defines an uint64 option with specified name, default value, and usage string. The argument p points to a uint64 variable in which to store the value of the option.

func (*EnvSet) UintSlice added in v0.5.0

func (es *EnvSet) UintSlice(
	name string,
	value []uint,
	usage string,
) *[]uint

Uint defines a slice of uint option with specified name, default value, and usage string. The return value is the address of a slice of uint variable that stores the value of the option.

func (*EnvSet) UintSliceVar added in v0.5.0

func (es *EnvSet) UintSliceVar(
	p *[]uint,
	name string,
	value []uint,
	usage string,
)

UintSliceVar defines a slice of uint option with specified name, default value, and usage string. The argument p points to a slice of uint variable in which to store the value of the option.

func (*EnvSet) UintVar

func (es *EnvSet) UintVar(
	p *uint,
	name string,
	value uint,
	usage string,
)

Uint defines an uint option with specified name, default value, and usage string. The argument p points to a uint variable in which to store the value of the option.

func (*EnvSet) Var

func (es *EnvSet) Var(val option.Value, name string, usage string)

Var defines an environment variable with the specified name and usage string. The type and value of the env var are represented by the first argument, of type option.Value, which typically holds a user-defined implementation of option.Value. For instance, the caller could create an env var that turns a comma-separated string into a slice of strings by giving the slice the methods of option.Value; in particular, Set would decompose the comma-separated string into the slice.

func (*EnvSet) Visit

func (es *EnvSet) Visit(fn func(*EnvVar))

Visit visits the command-line env vars in lexicographical order, calling fn for each. It visits only those env vars that have been set.

func (*EnvSet) VisitAll

func (es *EnvSet) VisitAll(fn func(*EnvVar))

VisitAll visits the env vars in lexicographical order, calling fn for each. It visits all env vars, even those not set.

type EnvVar

type EnvVar = option.Option

EnvVar represents the state of an environment variable.

type ErrorHandling

type ErrorHandling = flag.ErrorHandling

ErrorHandling defines how EnvSet.Parse behaves if the parse fails.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL