tmpl

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: GPL-3.0, GPL-3.0-or-later Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindMatchingTemplates

func FindMatchingTemplates(filePath string, templateFiles []string) []string

func MatchesFilename

func MatchesFilename(fileName, templateName string) bool

func ParseFilename

func ParseFilename(fileName, templateName string) map[string]string

Types

type Template

type Template struct {
	Name         string    `yaml:"name"`
	UserVars     []UserVar `yaml:"vars"`
	TemplateName string
	Content      string
	Data         map[string]string
}

func LoadTemplate

func LoadTemplate(filePath string, templatePath string) (*Template, error)

func ParseTemplate

func ParseTemplate(fileName, templateName string, r io.Reader) (*Template, error)

func (*Template) Render

func (t *Template) Render() (string, error)

type UserVar

type UserVar struct {
	Name    string `yaml:"name"`
	Prompt  string `yaml:"prompt"`
	Default string `yaml:"default"`
}

Jump to

Keyboard shortcuts

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