env

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env struct {
	// contains filtered or unexported fields
}

An Env provides a simple interface to manipulate environment variables

func New

func New(env []string) (e *Env)

New returns a new Env from an arbitrary list of variables

func NewFromOS

func NewFromOS() (e *Env)

NewFromOS returns a new Env with variables from os.Environ()

func (*Env) Changed

func (e *Env) Changed() []VariableChange

Changed returns all changes made on the variables

func (*Env) Environ

func (e *Env) Environ() (vars []string)

Environ returns all variable as os.Environ() would

func (*Env) Get

func (e *Env) Get(name string) string

Get returns the value of a variable (defaults to empty string)

func (*Env) GetActiveFeatures

func (e *Env) GetActiveFeatures() map[string]string

GetActiveFeatures returns a Hash of feature name -> param

func (*Env) PrependToPath

func (e *Env) PrependToPath(path string)

PrependToPath inserts a new path at the beginning of the PATH variable

func (*Env) RemoveFromPath

func (e *Env) RemoveFromPath(substring string)

RemoveFromPath removes all path entries matching a substring

func (*Env) Set

func (e *Env) Set(name string, value string)

Set adds or changes a variable

func (*Env) SetFeature

func (e *Env) SetFeature(name, param string)

SetFeature marks a feature as active

func (*Env) Unset

func (e *Env) Unset(name string)

Unset removes a variable if it exists

func (*Env) UnsetFeature

func (e *Env) UnsetFeature(name string)

UnsetFeature marks a feature as inactive

type VariableChange

type VariableChange struct {
	Name    string
	Value   string
	Deleted bool
}

A VariableChange represents the change made on a variable

Jump to

Keyboard shortcuts

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