envvars

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PathEnvVarName  = "PATH"
	ShellEnvVarName = "SHELL"
)

Environment variable names

Variables

This section is empty.

Functions

func LoadConfiguredEnvironment

func LoadConfiguredEnvironment(customConfigFiles []string, workingDirectory string)

LoadConfiguredEnvironment updates the environment with user and local configuration. First Bash's env is read (as a fallback), then the user's preferred SHELL's env is read, then the configuration files. The Bash env PATH is appended to the existing PATH (as a fallback), any other new PATH read is prepended (preferential).

func UpdatePath

func UpdatePath(pathExtension string, prepend bool) string

UpdatePath prepends or appends the extension to the current path. For append, if the entry is already there, it will not be re-added / moved. For prepend, if the entry is already there, it will be correctly re-prioritized to the front. The result is set into the process environment with os.Setenv.

pathExtension string the path component to be added.
prepend bool whether to pre- or append

Types

This section is empty.

Jump to

Keyboard shortcuts

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