render

package
v0.29.3 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(stdout io.Writer, loader *tmpl.Loader, tmplName string, data any, opts Options) error

func WriteRaw added in v0.14.0

func WriteRaw(stdout io.Writer, body []byte, opts Options) error

WriteRaw applies the standard --out / --stdout / --force / --dry-run / --quiet routing to an already-rendered body. Used by commands that render their content inline (currently: license, whose template bodies are Go constants rather than embedded files).

Types

type ArtifactPayload added in v0.14.0

type ArtifactPayload interface {
	ArtifactPayload() (sections []sections.RenderedSection, ctx any)
}

ArtifactPayload is implemented by cmd-level data structs that join the v1 artifact render path (currently: postmortem). It lets the render pipeline extract the pre-merged section list and the per-template ctx without coupling to cmd-specific types.

type Options

type Options struct {
	Out          string
	Stdout       bool
	Force        bool
	DryRun       bool
	Default      string
	TemplatePath string // optional: read template from this file path instead of the embedded/loader chain
	JSON         bool   // emit the template data as JSON instead of rendering the template
	Quiet        bool   // suppress informational messages (the "wrote <file>" line, dry-run notes)
	// BootstrapJSON wraps `data` in a `{meta, sections: [{id:"body", …}]}`
	// envelope when emitting --json, so legacy `text/template` commands
	// produce the same shape as artifact-path commands. Every shipped
	// generator is now on the artifact path (v0.20.0) and sets
	// BootstrapJSON=false, but the wrapping is kept for external tooling
	// that ships custom `.tmpl` commands via the public Render API.
	BootstrapJSON bool
	// RenderArtifact switches the render path from Go-template execution
	// to the v1 YAML artifact format. When true, the loader resolves
	// <name>.yaml via LoadArtifactBytes, ParseArtifact builds an Artifact,
	// and sections.RenderArtifact composes the markdown. `data` must
	// implement ArtifactPayload (returning the pre-merged section list
	// and the template ctx). Every shipped generator sets this to true.
	RenderArtifact bool
}

Jump to

Keyboard shortcuts

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