env

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HookFlag = "__VFOX_SHELL"
	PidFlag  = "__VFOX_PID"
)

Variables

This section is empty.

Functions

func GetPid added in v0.2.5

func GetPid() int

func IsHookEnv

func IsHookEnv() bool

Types

type Envs

type Envs struct {
	Variables Vars
	BinPaths  *Paths
	Paths     *Paths
}

Envs is a struct that contains environment variables and PATH.

type Manager

type Manager interface {
	Flush() error
	Load(envs *Envs) error
	Get(key string) (string, bool)
	Remove(envs *Envs) error
	io.Closer
}

func NewEnvManager

func NewEnvManager(vfConfigPath string) (Manager, error)

type PathFrom added in v0.3.0

type PathFrom int
const (
	EmptyPaths PathFrom = iota
	OsPaths
)

type Paths added in v0.2.5

type Paths struct {
	*util.SortedSet[string]
}

Paths is a slice of PATH.

func NewPaths added in v0.3.0

func NewPaths(from PathFrom) *Paths

NewPaths returns a new Paths. from is the source of the paths. If from is OsPaths, it returns the paths from the environment variable PATH. If from is PreviousPaths, it returns the paths from the environment variable __VFOX_PREVIOUS_PATHS If from is neither OsPaths nor PreviousPaths, it returns an empty Paths.

func (*Paths) Merge added in v0.3.0

func (p *Paths) Merge(other *Paths) *Paths

func (*Paths) String added in v0.3.0

func (p *Paths) String() string

func (*Paths) ToBinPaths added in v0.5.0

func (p *Paths) ToBinPaths() (*Paths, error)

ToBinPaths returns a BinPaths from Paths which contains only executable files.

type Vars added in v0.2.5

type Vars map[string]*string

Vars is a map of environment variables

Jump to

Keyboard shortcuts

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