Documentation
¶
Index ¶
- type Variables
- func (v *Variables) Envs(val string) *Variables
- func (v *Variables) Err() error
- func (v *Variables) Eval(str string) string
- func (v *Variables) ExpandVar(str string, expandFunc func(string) string) string
- func (v *Variables) SetEnv(name, value string) *Variables
- func (v *Variables) SetVar(name, value string) *Variables
- func (v *Variables) UnsetVar(name string) *Variables
- func (v *Variables) Val(name string) string
- func (v *Variables) Vars(val string) *Variables
- func (v *Variables) WithEscapeChar(r rune) *Variables
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Variables ¶
Variables stores a variable map that used for variable expansion in parsed commands and other parsed strings.
func (*Variables) Envs ¶
Envs declares process environment variables using a multi-line space-separated list of KEY=VAL format: i.e. GOOS=linux GOARCH=amd64
func (*Variables) Eval ¶
Eval returns the string str with its content expanded with variable values i.e. Eval("I am $HOME") returns "I am </user/home/path>"
func (*Variables) ExpandVar ¶
ExpandVar searches str for $value or ${value} which is then evaluated using os.ExpandEnv. If variable starts with <escapeChar>$, the expansion sequence will be ignored. For instance if the escapeChar is '\', when \$value or \${value} is encountered, the variable expansion is ignored leaving the original values in the string as $value or ${value}.
func (*Variables) Val ¶
Val searches for a Var with provided key, if not found searches for environment var, for running process, with same key
func (*Variables) Vars ¶
Vars declares an internal variable used during current gexe session. It uses a multi-line, space-separated list of KEY=VAL format: i.e. foo=bar fuzz=buzz
func (*Variables) WithEscapeChar ¶
WithEscapeChar sets the espacape char for the variable