env

package
v0.0.0-...-eb599cc Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Environment

type Environment []*Variable

Environment is a set of environment variables

func Parse

func Parse(paths ...string) (Environment, error)

Parse reads env files into a slice of Variables. If multiple files contain the same key, the file specified last takes precedence. Empty lines and lines starting with a # are ignored.

func (Environment) AsSh

func (e Environment) AsSh() []string

AsSh returns a slice of the variables in teh Bourne shell format name=value.

func (Environment) Lookup

func (e Environment) Lookup(key string) (string, bool)

Lookup returns the value of the environment variable with the given key. If the variable does not exist, the empty string and false are returned.

type Variable

type Variable struct {
	Name  string
	Value string
}

Variable represents a single environment variable

func (*Variable) AsSh

func (v *Variable) AsSh() string

AsSh returns the environment variable in the Bourne shell format name=value.

Jump to

Keyboard shortcuts

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