templates

package
v0.0.72 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 10 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyTemplate

func ApplyTemplate(t string, data any) (string, error)

ApplyTemplate takes a YAML template as []byte, populates it using data, and returns the result as a string.

func ApplyTemplateFrom added in v0.0.26

func ApplyTemplateFrom(fs shared.FileSystem, f string, obj any) (string, error)

func Copy added in v0.0.13

func Copy(ctx context.Context, fs shared.FileSystem, f shared.File, destination shared.File) error

func CopyAndApply

func CopyAndApply(ctx context.Context, fs shared.FileSystem, root shared.Dir, destination shared.Dir, obj any) error

func CopyAndApplyTemplate

func CopyAndApplyTemplate(ctx context.Context, fs shared.FileSystem, f shared.File, destination shared.File, obj any) error

func CopyAndReplace

func CopyAndReplace(ctx context.Context, fs shared.FileSystem, f shared.File, destination shared.File, replacer Replacer) error

func CopyAndVisit

func CopyAndVisit(ctx context.Context, fs shared.FileSystem, root shared.Dir, destination shared.Dir, visitor FileVisitor) error

func Walk

func Walk(ctx context.Context, fs shared.FileSystem, root shared.Dir, ignore shared.Ignore, files *[]shared.File, dirs *[]shared.Dir) error

Types

type AlreadyExistError

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

func (AlreadyExistError) Error

func (a AlreadyExistError) Error() string

type FileVisitor

type FileVisitor interface {
	Apply(ctx context.Context, from shared.File, to shared.Dir) error
	Skip(file string) bool
}

type Ignore

type Ignore interface {
	Ignore(file shared.File) bool
}

type Replacer

type Replacer interface {
	Do([]byte) ([]byte, error)
}

type ServiceReplacer

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

func NewServiceReplacer

func NewServiceReplacer(gen *generation.Service) *ServiceReplacer

func (*ServiceReplacer) Do

func (r *ServiceReplacer) Do(content []byte) ([]byte, error)

type Source

type Source interface {
	ReadDir(dir shared.Dir) ([]os.DirEntry, error)
	ReadFile(file shared.File) ([]byte, error)
	Next() Source
}

Jump to

Keyboard shortcuts

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