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.