env

package
v0.6.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Index

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL