func Eval(s string, mapping func(string) string) (string, error)
Eval replaces ${var} in the string based on the mapping function.
func EvalEnv(s string) (string, error)
EvalEnv replaces ${var} in the string according to the values of the current environment variables. References to undefined variables are replaced by the empty string.
Template is the representation of a parsed shell format string.
type Template struct {
// contains filtered or unexported fields
}
func Parse(s string) (t *Template, err error)
Parse creates a new shell format template and parses the template definition from string s.
func ParseFile(path string) (*Template, error)
ParseFile creates a new shell format template and parses the template definition from the named file.
func (t *Template) Execute(mapping func(string) string) (str string, err error)
Execute applies a parsed template to the specified data mapping.