scaffold

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// TargetDirectory is where to place the resulting rendered files, must not exist
	TargetDirectory string `yaml:"target"`
	// SourceDirectory reads templates from a directory, mutually exclusive with Source
	SourceDirectory string `yaml:"source_directory"`
	// Source reads templates from in-process memory
	Source map[string]any `yaml:"source"`
	// Post configures post-processing of files using filepath globs
	Post []map[string]string `yaml:"post"`
	// SkipEmpty skips files that are 0 bytes after rendering
	SkipEmpty bool `yaml:"skip_empty"`
	// Sets a custom template delimiter, useful for generating templates from templates
	CustomLeftDelimiter string `yaml:"left_delimiter"`
	// Sets a custom template delimiter, useful for generating templates from templates
	CustomRightDelimiter string `yaml:"right_delimiter"`
}

Config configures a scaffolding operation

type Logger

type Logger interface {
	Debugf(format string, v ...any)
	Infof(format string, v ...any)
}

type Scaffold

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

func New

func New(cfg Config, funcs template.FuncMap) (*Scaffold, error)

New creates a new scaffold instance

func (*Scaffold) Logger

func (s *Scaffold) Logger(log Logger)

Logger configures a logger to use, no logging is done without this

func (*Scaffold) Render

func (s *Scaffold) Render(data any) error

Render creates the target directory and place all files into it after template processing and post-processing

Jump to

Keyboard shortcuts

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