Documentation
¶
Index ¶
- Constants
- func CollectValues(variables map[string]Variable, order []string) (map[string]any, error)
- func Generate(opts Options) error
- func ShowProgress(message, successMessage string, operation func() error) error
- type Config
- type Executor
- type Hooks
- type Options
- type Renderer
- type Resolver
- type TemplateSettings
- type Variable
Constants ¶
const CutrYAML = "cutr.yaml"
Variables ¶
This section is empty.
Functions ¶
func CollectValues ¶
CollectValues prompts for and collects user input for template variables
func ShowProgress ¶
ShowProgress displays a progress bar for long-running operations
Types ¶
type Config ¶
type Config struct {
// Template metadata
Name string `yaml:"name"`
Description string `yaml:"description,omitempty"`
Version string `yaml:"version,omitempty"`
Author string `yaml:"author,omitempty"`
Repository string `yaml:"repository,omitempty"`
// Template variables
Variables map[string]Variable `yaml:"variables"`
// Optional hooks
Hooks Hooks `yaml:"hooks,omitempty"`
// Template settings
Template TemplateSettings `yaml:"template,omitempty"`
// contains filtered or unexported fields
}
Config represents the complete cutr template configuration
func ParseCutrYAML ¶
ParseCutrYAML parses a cutr.yaml configuration file
func (Config) GetVariableOrder ¶
GetVariableOrder returns variable names in their YAML definition order
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor handles hook execution operations.
func NewWithStream ¶
NewWithStream creates a new hook executor with a provided tap stream.
type Hooks ¶
type Hooks struct {
PreGeneration []string `yaml:"pre_generation,omitempty"`
PostGeneration []string `yaml:"post_generation,omitempty"`
}
Hooks defines pre and post generation commands
type Options ¶
type Options struct {
Source string // Template source (path or URL)
OutputDir string // Output directory
}
Options contains the configuration for template generation
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer handles template rendering operations.
func (*Renderer) RenderTree ¶
RenderTree walks the source template directory and renders all files to the output directory.
func (*Renderer) RenderTreeWithSettings ¶
func (r *Renderer) RenderTreeWithSettings(srcRoot, outRoot string, data map[string]any, settings TemplateSettings) error
RenderTreeWithSettings walks the source template directory and renders all files to the output directory using the provided template settings.
type Resolver ¶
type Resolver struct{}
Resolver handles template source resolution (local paths or git repositories)
type TemplateSettings ¶
type TemplateSettings struct {
IgnorePatterns []string `yaml:"ignore_patterns,omitempty"`
KeepPermissions bool `yaml:"keep_permissions,omitempty"`
}
TemplateSettings defines template engine configuration
type Variable ¶
type Variable struct {
Type string `yaml:"type"`
Prompt string `yaml:"prompt,omitempty"`
Default any `yaml:"default,omitempty"`
Choices []string `yaml:"choices,omitempty"`
Pattern string `yaml:"pattern,omitempty"`
Help string `yaml:"help,omitempty"`
Min int `yaml:"min,omitempty"`
Max int `yaml:"max,omitempty"`
}
Variable represents a template variable definition