Documentation ¶
Index ¶
- type EnvironmentRegistry
- func (er *EnvironmentRegistry) Env(key string) string
- func (er *EnvironmentRegistry) ExpandEnv(str string) string
- func (or *EnvironmentRegistry) LinkHandler(fh sprout.Handler) error
- func (er *EnvironmentRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error
- func (or *EnvironmentRegistry) Uid() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EnvironmentRegistry ¶
type EnvironmentRegistry struct {
// contains filtered or unexported fields
}
func NewRegistry ¶
func NewRegistry() *EnvironmentRegistry
NewRegistry creates a new instance of env registry.
func (*EnvironmentRegistry) Env ¶
func (er *EnvironmentRegistry) Env(key string) string
Env retrieves the value of an environment variable.
Parameters:
key string - the name of the environment variable.
Returns:
string - the value of the environment variable.
Example:
{{ "PATH" | env }} // Output: "/usr/bin:/bin:/usr/sbin:/sbin"
func (*EnvironmentRegistry) ExpandEnv ¶
func (er *EnvironmentRegistry) ExpandEnv(str string) string
ExpandEnv replaces ${var} or $var in the string based on the values of the current environment variables.
Parameters:
str string - the string with environment variables to expand.
Returns:
string - the expanded string.
Example:
{{ "Path is $PATH" | expandEnv }} // Output: "Path is /usr/bin:/bin:/usr/sbin:/sbin"
func (*EnvironmentRegistry) LinkHandler ¶
func (or *EnvironmentRegistry) LinkHandler(fh sprout.Handler) error
LinkHandler links the handler to the registry at runtime.
func (*EnvironmentRegistry) RegisterFunctions ¶
func (er *EnvironmentRegistry) RegisterFunctions(funcsMap sprout.FunctionMap) error
RegisterFunctions registers all functions of the registry.
func (*EnvironmentRegistry) Uid ¶
func (or *EnvironmentRegistry) Uid() string
Uid returns the unique identifier of the registry.
Click to show internal directories.
Click to hide internal directories.