template

package
v0.0.0-...-55ed90b Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

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

Parser is the representation of an initialized Infracost template parser. It exposes custom template functions to the user which can act on Parser.repoDir or in isolation.

func NewParser

func NewParser(repoDir string, variables Variables) *Parser

NewParser returns a safely initialized Infracost template parser, this builds the underlying template with the Parser functions and sets the underlying default template name. Default variables can be passed to the parser which will be passed to the template on execution.

func (*Parser) Compile

func (p *Parser) Compile(template string, wr io.Writer) error

Compile writes an Infracost config to io.Writer wr using the provided template string.

func (*Parser) CompileFromFile

func (p *Parser) CompileFromFile(templatePath string, wr io.Writer) error

CompileFromFile writes an Infracost config to io.Writer wr using the provided template path.

type Variables

type Variables struct {
	Branch     string
	BaseBranch string
}

Variables hold the global variables that are passed into any template that the Parser evaluates.

Jump to

Keyboard shortcuts

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