env

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Path    *Path
	EnvVars []string
	WorkDir string
}

Config represents the an environment configuration

type Env

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

Env represents the Env type

func New

func New(config Config) (*Env, error)

New configures a new environment

func (*Env) AddEnvVars

func (e *Env) AddEnvVars(envvars ...string)

AddEnvVars adds a list of environment variables

func (*Env) Close

func (e *Env) Close()

Close cleans up resources created by the env

func (*Env) GetEnvVar

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

GetEnvVar returns the value of the given environment variable in the current environment

func (*Env) GetEnvVars

func (e *Env) GetEnvVars() []string

GetEnvVars provides all the environment variables (including the generated PATH)

func (*Env) GetPath

func (e *Env) GetPath() string

GetPath returns the current PATH directory

func (e *Env) Link(source string, linkFileName string) error

Link creates a symlink in the environment path to the source file if linkName is empty, will use the same filename

func (*Env) Run

func (e *Env) Run(cmdString string) (string, error)

Run runs a shell command in the environment

func (*Env) SetWorkDir

func (e *Env) SetWorkDir(workDir string)

SetWorkDir sets the current working directory

type Path

type Path struct {
	Directory     string
	Prefix        string
	RemoveOnClose bool
}

Path represents the environment's PATH configuration

Jump to

Keyboard shortcuts

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