common

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 CanStartWithDash

func CanStartWithDash(parts []syntax.WordPart) bool

CanStartWithDash reports whether any of the arguments bash produces from a word (after brace expansion and quote removal) may start with '-'.

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 SplitBracesInPlace

func SplitBracesInPlace(f *syntax.File)

SplitBracesInPlace rewrites the brace expansions (e.g. `{a,b}`) of words in AST positions where bash performs brace expansion into BraceExp nodes, so that they are compared structurally. The parser leaves them as literals otherwise.

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