templates

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 8 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 Copy added in v0.0.13

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

func CopyAndApply

func CopyAndApply(logger shared.BaseLogger, fs shared.FileSystem, root shared.Dir, destination shared.Dir, obj any, ignore Ignore) error

func CopyAndApplyTemplate

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

func CopyAndReplace

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

func CopyAndVisit

func CopyAndVisit(logger shared.BaseLogger, fs shared.FileSystem, root shared.Dir, destination shared.Dir, visitor FileVisitor) error

func Walk

func Walk(logger shared.BaseLogger, fs shared.FileSystem, root shared.Dir, ignore 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(path shared.File, to shared.Dir) error
	Ignore(file shared.File) bool
}

type Ignore

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

type IgnorePatterns added in v0.0.15

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

func NewIgnore added in v0.0.15

func NewIgnore(patterns ...string) IgnorePatterns

func (IgnorePatterns) Ignore added in v0.0.15

func (ign IgnorePatterns) Ignore(file shared.File) bool

type NoOpIgnore

type NoOpIgnore struct{}

func (NoOpIgnore) Ignore

func (ign NoOpIgnore) 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