contexttmpl

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 1 Imported by: 0 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 contexttmpl expands Wirecmd's fixed invocation-context references.

Index

Constants

View Source
const (
	CWD         = "wirecmd.cwd"
	ProjectRoot = "wirecmd.project-root"
	GlobalRoot  = "wirecmd.global-root"
)

Variables

This section is empty.

Functions

func Expand

func Expand(input string, context Context) (string, error)

Expand substitutes fixed context references once. Resolved values are never scanned again, and $$ emits one literal dollar sign.

func ExpandFragment

func ExpandFragment(input string, context Context) (string, bool, error)

ExpandFragment expands one template fragment while allowing it to contain no references. The result reports whether at least one reference was expanded.

func Validate

func Validate(input string) error

Validate checks a template without expanding it.

func ValidateFragment

func ValidateFragment(input string) (bool, error)

ValidateFragment checks template syntax while allowing a fragment with no references. The result reports whether at least one context reference was present. It is used by structured formats whose individual strings may be literals while the enclosing document is a template.

Types

type Context

type Context struct {
	CWD         string
	ProjectRoot string
	GlobalRoot  string
}

Context contains the only values available to a Wirecmd template.

type UnavailableError

type UnavailableError struct{ Name string }

UnavailableError reports a known reference whose value is unavailable.

func (*UnavailableError) Error

func (e *UnavailableError) Error() string

Jump to

Keyboard shortcuts

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