ext

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package ext provides the Go template extension function registry. It aggregates both third-party (sprig) and custom scafctl-specific template functions, making them discoverable via MCP tools and CLI commands.

This follows the same pattern as pkg/celexp/ext for CEL extensions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func All

func All() gotmpl.ExtFunctionList

All returns a combined list of all Go template extension functions, including both sprig functions and custom scafctl-specific functions. Custom functions are listed after sprig functions so they take precedence when merged into a template.FuncMap.

Example usage:

funcs := ext.All()
funcMap := funcs.FuncMap()

func AllFuncMap

func AllFuncMap() template.FuncMap

AllFuncMap is a convenience function that returns a merged template.FuncMap containing all extension functions (sprig + custom).

func Custom

func Custom() gotmpl.ExtFunctionList

Custom returns a list of custom scafctl-specific Go template extension functions. These are functions with Custom=true that extend Go templates with project-specific functionality.

Example usage:

funcs := ext.Custom()
for _, f := range funcs {
    fmt.Printf("Custom Function: %s (%s)\n", f.Name, f.Description)
}

func Sprig

func Sprig() gotmpl.ExtFunctionList

Sprig returns a list of ExtFunction entries for all sprig template functions. Each function is wrapped with metadata for discoverability. These are marked as Custom=false since they come from the third-party sprig library.

Example usage:

funcs := ext.Sprig()
for _, f := range funcs {
    fmt.Printf("Sprig Function: %s\n", f.Name)
}

Types

This section is empty.

Directories

Path Synopsis
Package celeval provides a Go template extension function for evaluating CEL (Common Expression Language) expressions inline within Go templates.
Package celeval provides a Go template extension function for evaluating CEL (Common Expression Language) expressions inline within Go templates.
Package collections provides Go template extension functions for filtering and projecting lists of maps, enabling common data transformation patterns directly within Go templates.
Package collections provides Go template extension functions for filtering and projecting lists of maps, enabling common data transformation patterns directly within Go templates.
Package dns provides Go template extension functions for converting arbitrary strings into DNS-safe label format (RFC 1123).
Package dns provides Go template extension functions for converting arbitrary strings into DNS-safe label format (RFC 1123).
Package hcl provides a Go template extension function for converting Go objects into HCL (HashiCorp Configuration Language) format.
Package hcl provides a Go template extension function for converting Go objects into HCL (HashiCorp Configuration Language) format.
Package host provides Go template extension functions that expose the host's resolved XDG configuration directory.
Package host provides Go template extension functions that expose the host's resolved XDG configuration directory.
Package yaml provides Go template extension functions for YAML serialization and deserialization.
Package yaml provides Go template extension functions for YAML serialization and deserialization.

Jump to

Keyboard shortcuts

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