environment

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package environment is used to store and retrieve variables by our run-time Executor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Environment

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

Environment stores our state

func New

func New() *Environment

New returns a new Environment object.

The new environment receives some default variable/values, which currently include the architecture of the host system, the operating-system upon which we're running, & etc.

func (*Environment) ExpandBacktick added in v0.17.0

func (e *Environment) ExpandBacktick(value string) (string, error)

ExpandBacktick is similar to the ExpandVariables, it expands any variables within the given string, then executes that as a command.

func (*Environment) ExpandVariables added in v0.14.0

func (e *Environment) ExpandVariables(input string) string

ExpandVariables takes a string which contains embedded variable references, such as ${USERNAME}, and expands the result.

func (*Environment) Get

func (e *Environment) Get(key string) (string, bool)

Get retrieves the named value from the environment, along with a boolean value to indicate whether the retrieval was successful.

func (*Environment) Set

func (e *Environment) Set(key string, val string)

Set updates the environment to store the given value against the specified key.

Any previously-existing value will be overwritten.

func (*Environment) Variables

func (e *Environment) Variables() map[string]string

Variables returns all of variables which have been set, as well as their values.

This is used such that include-files inherit the variables which were already in-scope at the point the inclusion happens.

Jump to

Keyboard shortcuts

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