common

package
v0.0.0-...-7a7d9b3 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package common implements common functionality for dealing with text/template.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaselineString

func BaselineString(string) string

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

func BuildTextTemplateFuncMap(safeTmplUUID string) map[string]any

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

func DeepCopyMutateStrings(data any, mutateF func(string) string) any

DeepCopyMutateStrings performs a deep copy, but mutates any strings according to the mutation callback.

func EchoString

func EchoString(in string) string

EchoString is a nop string 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.

func WalkApplyFuncToNonDeclaractiveActions

func WalkApplyFuncToNonDeclaractiveActions(template *template.Template, node parse.Node)

WalkApplyFuncToNonDeclaractiveActions walks the AST, applying a pipeline function to any "paste" nodes (non-declarative action nodes)

Types

This section is empty.

Jump to

Keyboard shortcuts

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