moustache

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package moustache implements pkgx's `{{token}}` template substitution, a faithful port of libpkgx's useMoustaches. Build and test scripts, env values and fixtures are expanded with it before they run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(input string, tokens []Token) string

Apply substitutes every token in input. The pattern mirrors libpkgx exactly: `(^\$)?{{\s*<from>\s*}}` — optional surrounding whitespace, and a single leading `$` (at the very start) is consumed so `${{prefix}}` yields the value without the dollar. Replacement is literal (a To containing `$` is safe).

Types

type Dep

type Dep struct {
	Project string
	Version string
	Path    string
}

Dep is an installed dependency contributing deps.<Project>.* tokens.

type Token

type Token struct{ From, To string }

Token is a single substitution: every `{{ From }}` becomes To.

func Deps

func Deps(deps []Dep) []Token

Deps returns the tokens for a build's resolved dependencies.

func Host

func Host(arch, triple, platform string, concurrency int) []Token

Host returns the {{hw.*}} tokens describing the build TARGET.

func Prefix

func Prefix(installPath string) []Token

Prefix returns the {{prefix}} token (the package's install path).

func Version

func Version(version, prefix string) []Token

Version returns the version tokens for a version string under prefix (usually "version", or "deps.<project>.version" for a dependency).

Jump to

Keyboard shortcuts

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