envedit

package
v0.11.1-0...-8ab92b3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoEnvFile is returned when the environment file cannot be found
	ErrNoEnvFile = fmt.Errorf("no environment file found")
)

Functions

func Edit

func Edit(file string, updates map[string]string) (string, error)

Edit takes a file and a list of updates as a map of strings. The updates should represent the ENV_VAR VAL. Edit will check the file line by line for each change and if the environment variable is contained in the updates, it will update and save the file.

func EnvExists

func EnvExists(file, key string) bool

EnvExists takes an existing env file and key and checks if the env var has already been defined. If it has been defined it will return true otherwise it will return false. If the file does not exist, it will return false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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