Documentation
¶
Overview ¶
Package env implements a case-insensitive shell environment with DOS-style variable expansion.
Index ¶
- type Env
- func (e *Env) All() map[string]string
- func (e *Env) Args() []string
- func (e *Env) Delete(key string)
- func (e *Env) Expand(s string) string
- func (e *Env) ExpandDelayed(s string) string
- func (e *Env) Get(key string) string
- func (e *Env) ImportHost(keys []string)
- func (e *Env) Restore(snapshot map[string]string)
- func (e *Env) Set(key, val string)
- func (e *Env) SetArgs(args []string)
- func (e *Env) Snapshot() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
Env holds shell environment variables with case-insensitive keys.
func (*Env) Expand ¶
Expand replaces %VAR% and %0..%9 references in s. Unknown variables expand to empty string. %% becomes %. A lone % with no closing % is left as-is.
func (*Env) ExpandDelayed ¶
ExpandDelayed replaces !VAR! references with their current values. A lone ! with no closing ! is passed through unchanged. This is a no-op when delayed expansion is not enabled - callers are responsible for checking the flag before calling.
func (*Env) ImportHost ¶
ImportHost copies named variables from the host environment into e.
func (*Env) Restore ¶
Restore replaces the entire variable map with the provided snapshot. The args vector is left unchanged.