Documentation
¶
Overview ¶
Package common implements common functionality for dealing with text/template.
Index ¶
- func BaselineString(string) string
- func BuildTextTemplateFuncMap(safeTmplUUID string) map[string]any
- func DeepCopyMutateStrings(data any, mutateF func(string) string) any
- func EchoString(in string) string
- func ExecuteWithCallback(tmpl *template.Template, safeTmplUUID string, cb func(string) string, ...) error
- func ExecuteWithShCallback(tmpl *template.Template, safeTmplUUID string, cb func(string) string, ...) error
- func WalkApplyFuncToNonDeclaractiveActions(template *template.Template, node parse.Node)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BaselineString ¶
BaselineString is a string callback function that just returns a constant string, used to get a baseline of how the resultant YAML is structured.
func BuildTextTemplateFuncMap ¶
BuildTextTemplateFuncMap generates a per template (using its name as identifier) FuncMap. A Virtual callback is created as once Template.Parse() is called this is not something we can update. However, in its current design, safetext requires changing the methods as templates are executed multiple times and outputs are diffed to detect injection
func DeepCopyMutateStrings ¶
DeepCopyMutateStrings performs a deep copy, but mutates any strings according to the mutation callback.
func ExecuteWithCallback ¶
func ExecuteWithCallback(tmpl *template.Template, safeTmplUUID string, cb func(string) string, result io.Writer, data any) error
ExecuteWithCallback performs an execution on a callback-applied template (WalkApplyFuncToNonDeclaractiveActions) with a specified callback.
func ExecuteWithShCallback ¶
func ExecuteWithShCallback(tmpl *template.Template, safeTmplUUID string, cb func(string) string, allowFlagsCb func(string) string, result io.Writer, data any) error
ExecuteWithShCallback is like ExecuteWithCallback, but with the additional sh-specific callbacks specified.
Types ¶
This section is empty.