commit this WIP stuff to a feature branch
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
package envs
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"github.com/shirou/gopsutil/v4/process"
|
||||
)
|
||||
|
||||
type (
|
||||
/*
|
||||
EnvErrNoVal is an error containing the variable that does not exist
|
||||
@@ -7,14 +13,29 @@ type (
|
||||
*/
|
||||
EnvErrNoVal struct {
|
||||
// VarName is the variable name/key name originally specified in the function call.
|
||||
VarName string `json:"var" toml:"VariableName" yaml:"Variable Name/Key" xml:"key,attr"`
|
||||
VarName string `json:"var" toml:"VariableName" yaml:"Variable Name/Key" xml:"key,attr"`
|
||||
// WasFound is only used for GetEnvErrNoBlank(). It is true if the variable was found/populated.
|
||||
WasFound bool `json:"found" toml:"Found" yaml:"Found" xml:"found,attr"`
|
||||
WasFound bool `json:"found" toml:"Found" yaml:"Found" xml:"found,attr"`
|
||||
// WasRequiredNonEmpty indicates that this error was returned in a context where a variable was required to be non-empty (e.g. via GetEnvErrNoBlank()) but was empty.
|
||||
WasRequiredNonEmpty bool `json:"reqd_non_empty" toml:"RequiredNonEmpty" yaml:"Required Non-Empty" xml:"reqNonEmpty,attr"`
|
||||
WasRequiredNonEmpty bool `json:"reqd_non_empty" toml:"RequiredNonEmpty" yaml:"Required Non-Empty" xml:"reqNonEmpty,attr"`
|
||||
// IgnoreWhitespace is true if the value was found but its evaluation was done against a whitestripped version.
|
||||
IgnoreWhitespace bool `json:"ignore_ws" toml:"IgnoreWhitespace" yaml:"Ignore Whitespace" xml:"ignoreWhitespace,attr"`
|
||||
IgnoreWhitespace bool `json:"ignore_ws" toml:"IgnoreWhitespace" yaml:"Ignore Whitespace" xml:"ignoreWhitespace,attr"`
|
||||
// WasWhitespace is true if the value was whitespace-only.
|
||||
WasWhitespace bool `json:"was_ws" toml:"WasWhitespace" yaml:"Was Whitespace Only" xml:"wasWhitespace,attr"`
|
||||
WasWhitespace bool `json:"was_ws" toml:"WasWhitespace" yaml:"Was Whitespace Only" xml:"wasWhitespace,attr"`
|
||||
}
|
||||
|
||||
/*
|
||||
StaticEnv is an environment variable mapping that duplicates the normal functions of the standalone functions
|
||||
but can be used for other processes, mock tests, etc.
|
||||
|
||||
(The standalone functions actually perform the same functions on the default StaticEnv as returned from [Current].)
|
||||
*/
|
||||
StaticEnv struct {
|
||||
dynamic bool
|
||||
strict bool
|
||||
envVars map[string]string
|
||||
self bool
|
||||
proc *process.Process
|
||||
lock sync.RWMutex
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user