template

package
v0.0.0-...-592e5ed Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBuiltinTemplates

func GetBuiltinTemplates() map[string]*TemplateConfig

GetBuiltinTemplates returns a map of built-in template configurations.

Types

type TemplateConfig

type TemplateConfig struct {
	Name        string                 `yaml:"name"`
	Description string                 `yaml:"description"`
	Template    map[string]interface{} `yaml:"template"`
	Variables   []TemplateVariable     `yaml:"variables"`
}

TemplateConfig represents a template configuration.

type TemplateEngine

type TemplateEngine struct {
	TemplateDir string
	Variables   map[string]interface{}
}

TemplateEngine handles configuration template processing.

func NewTemplateEngine

func NewTemplateEngine(templateDir string) *TemplateEngine

NewTemplateEngine creates a new template engine.

func (*TemplateEngine) CreateBuiltinTemplates

func (te *TemplateEngine) CreateBuiltinTemplates() error

CreateBuiltinTemplates creates built-in template files.

func (*TemplateEngine) DeleteTemplate

func (te *TemplateEngine) DeleteTemplate(name string) error

DeleteTemplate deletes a template.

func (*TemplateEngine) GenerateConfig

func (te *TemplateEngine) GenerateConfig(templateName string, variables map[string]interface{}) (map[string]interface{}, error)

GenerateConfig generates a configuration from a template.

func (*TemplateEngine) GetTemplateInfo

func (te *TemplateEngine) GetTemplateInfo(name string) (*TemplateConfig, error)

GetTemplateInfo returns information about a template.

func (*TemplateEngine) InterpolateString

func (te *TemplateEngine) InterpolateString(s string, variables map[string]interface{}) (string, error)

InterpolateString interpolates template variables in a string.

func (*TemplateEngine) ListTemplates

func (te *TemplateEngine) ListTemplates() ([]string, error)

ListTemplates returns available template names.

func (*TemplateEngine) LoadTemplate

func (te *TemplateEngine) LoadTemplate(name string) (*TemplateConfig, error)

LoadTemplate loads a template configuration by name.

func (*TemplateEngine) SaveTemplate

func (te *TemplateEngine) SaveTemplate(name string, config *TemplateConfig) error

SaveTemplate saves a template configuration.

func (*TemplateEngine) ValidateTemplate

func (te *TemplateEngine) ValidateTemplate(config *TemplateConfig) error

ValidateTemplate validates a template configuration.

type TemplateVariable

type TemplateVariable struct {
	Name         string      `yaml:"name"`
	Description  string      `yaml:"description"`
	Required     bool        `yaml:"required"`
	Type         string      `yaml:"type"`
	DefaultValue interface{} `yaml:"default,omitempty"`
	Options      []string    `yaml:"options,omitempty"`
}

TemplateVariable represents a template variable definition.

Jump to

Keyboard shortcuts

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