Discover Packages
github.com/cashapp/hermit
envars
package
Version:
v0.39.2
Opens a new window with list of versions in this module.
Published: May 15, 2024
License: Apache-2.0
Opens a new window with license information.
Imports: 9
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation Source Files Index Constants Variables Functions Types MarshalOps(ops) type Append type Envars type Force type Op type Ops type Prefix type Prepend type Set type Transform type Unset (e) Apply(transform) (e) Envar() (e) Revert(transform) (e) String() Parse(envars) (e) Apply(envRoot, ops) (e) Clone() (e) Revert(envRoot, ops) (e) System() (f) Apply(transform) (f) Envar() (f) Revert(transform) (f) String() Infer(env) UnmarshalOps(data) (p) Apply(transform) (p) Envar() (p) Revert(transform) (p) String() (e) Apply(transform) (e) Envar() (e) Revert(transform) (e) String() (e) Apply(transform) (e) Envar() (e) Revert(transform) (e) String() (t) Changed(undo) (t) Combined() (t) To(env) (e) Apply(transform) (e) Envar() (e) Revert(transform) (e) String()
Documentation
¶
type Append struct {
Name string ` json:"n"`
Value string ` json:"v"`
}
Append ensures an element exists at the end of a colon separated list.
Envars is a convenience alias
Parse a KEY=VALUE list of environment variables into an Envars map.
Apply ops to these Envars and return the resulting Transform.
Envars are not modified.
Revert creates a Transform that reverts the application of the provided Ops.
Envars are not modified.
System renders the Envars in the format expected by the system, ie. KEY=VALUE
type Force struct {
Name string ` json:"n"`
Value string ` json:"v"`
}
Force set/unset an environment variable without preserving or restoring its previous value.
Op is an operation on an environment variable.
Ops to apply to a set of environment variables.
Infer uses simple heuristics to build a sequence of transformations for environment variables.
Currently this consists of detecting prepend/append to :-separated lists, set and unset.
type Prefix struct {
Name string ` json:"n"`
Prefix string ` json:"p"`
}
Prefix ensures the environment variable has the given prefix.
type Prepend struct {
Name string ` json:"n"`
Value string ` json:"v"`
}
Prepend ensures an element exists at the beginning of a colon separated list.
type Set struct {
Name string ` json:"n"`
Value string ` json:"v"`
}
Set an environment variable.
type Transform struct {
}
Transform encapsulates low-level transformations on an existing environment.
Changed returns the set of changed Envars.
If "undo" is true the returned Envars will include undo state.
Combined returns a copy of the full set of original Envars with Changed applied.
Deleted keys will be removed.
To applies the Transform to "env" in place.
type Unset struct {
Name string ` json:"n"`
}
Unset an environment variable.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.