env

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Environ

func Environ() map[string]string

Environ returns all environment variables as a map

func GetEnv

func GetEnv(name string) string

GetEnv returns the value of an environment variable

func LookupEnv

func LookupEnv(name string) (string, bool)

LookupEnv returns the value of an environment variable and whether it was set

func RunEnv

func RunEnv(w io.Writer, args []string, opts EnvOptions) error

RunEnv prints environment variables

Types

type EnvOptions

type EnvOptions struct {
	NullTerminated bool   // -0: end each output line with NUL, not newline
	Unset          string // -u: remove variable from the environment (for display only)
	Ignore         bool   // -i: start with an empty environment
	JSON           bool   // --json: output in JSON format
}

EnvOptions configures the env command behavior

type EnvVar

type EnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

EnvVar represents an environment variable for JSON output

Jump to

Keyboard shortcuts

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