template

package
v0.0.0-...-f292767 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package template implements custom template output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compiler

type Compiler interface {
	CompileTemplates(*Output) error
}

Compiler is implemented by project blocks which support template compile.

type FileTemplate

type FileTemplate struct {
	// contains filtered or unexported fields
}

FileTemplate defines a single file template to be generated by this output.

func (*FileTemplate) NoOverwrite

func (t *FileTemplate) NoOverwrite() *FileTemplate

NoOverwrite generates the template only if it doesn't exist yet.

func (*FileTemplate) NoPreamble

func (t *FileTemplate) NoPreamble() *FileTemplate

NoPreamble disables preamble geneneration.

func (*FileTemplate) Params

func (t *FileTemplate) Params(value any) *FileTemplate

Params sets template params.

func (*FileTemplate) PreamblePrefix

func (t *FileTemplate) PreamblePrefix(value string) *FileTemplate

PreamblePrefix sets preamble prefix.

func (*FileTemplate) WithLicense

func (t *FileTemplate) WithLicense() *FileTemplate

WithLicense prepends the license text before the preamble.

func (*FileTemplate) WithLicenseText

func (t *FileTemplate) WithLicenseText(value string) *FileTemplate

WithLicenseText sets the license text.

If unset and WithLicense is requested, the default MPL license is used.

type Output

type Output struct {
	output.FileAdapter
	// contains filtered or unexported fields
}

Output implements custom templates generation.

func NewOutput

func NewOutput() *Output

NewOutput creates new Makefile output.

func (*Output) Compile

func (o *Output) Compile(compiler Compiler) error

Compile implements output.TypedWriter interface.

func (*Output) Define

func (o *Output) Define(name, template string) *FileTemplate

Define should be called to add a templated file output.

func (*Output) Filenames

func (o *Output) Filenames() []string

Filenames implements output.FileWriter interface.

func (*Output) GenerateFile

func (o *Output) GenerateFile(filename string, w io.Writer) error

GenerateFile implements output.FileWriter interface.

Jump to

Keyboard shortcuts

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