templates

package
v0.1.148 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: MIT Imports: 12 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)

func ApplyTemplateFrom added in v0.0.26

func ApplyTemplateFrom(ctx context.Context, 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 string, destination string) error

func CopyAndApply

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

func CopyAndApplyTemplate

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

func CopyAndReplace

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

func CopyAndVisit

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

func Walk

func Walk(ctx context.Context, fs shared.FileSystem, root string, pathSelect shared.PathSelect, files *[]string, dirs *[]string) error

Types

type AddTemplateSuffix added in v0.1.23

type AddTemplateSuffix struct {
}

func (AddTemplateSuffix) NewName added in v0.1.23

func (AddTemplateSuffix) NewName(base string) string

type AlreadyExistError

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

func (AlreadyExistError) Error

func (a AlreadyExistError) Error() string

type CutTemplateSuffix added in v0.1.23

type CutTemplateSuffix struct {
}

func (CutTemplateSuffix) NewName added in v0.1.23

func (CutTemplateSuffix) NewName(base string) string

type FileVisitor

type FileVisitor interface {
	Ignore(ctx context.Context, file string) bool
	Apply(ctx context.Context, from string, to string) error
}

type NameReplacer added in v0.1.23

type NameReplacer interface {
	NewName(base string) string
}

type NoOpName added in v0.1.144

type NoOpName struct {
}

func (NoOpName) NewName added in v0.1.144

func (NoOpName) NewName(base string) string

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 TemplateVisitor added in v0.1.23

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

func (TemplateVisitor) Apply added in v0.1.23

func (t TemplateVisitor) Apply(ctx context.Context, from string, to string) error

func (TemplateVisitor) Ignore added in v0.1.141

func (t TemplateVisitor) Ignore(ctx context.Context, file string) bool

type Templator added in v0.1.18

type Templator struct {
	PathSelect shared.PathSelect
	Override   shared.Override
	NameReplacer
}

func (*Templator) CopyAndApply added in v0.1.18

func (t *Templator) CopyAndApply(ctx context.Context, fs shared.FileSystem, root string, destination string, obj any) error

func (*Templator) Keep added in v0.1.20

func (t *Templator) Keep(name string) bool

func (*Templator) NewName added in v0.1.23

func (t *Templator) NewName(base string) string

func (*Templator) Replace added in v0.1.18

func (t *Templator) Replace(p string) bool

func (*Templator) WalkAndVisit added in v0.1.23

func (t *Templator) WalkAndVisit(ctx context.Context, fs shared.FileSystem, root string, destinationDir string, visitor FileVisitor) error

Jump to

Keyboard shortcuts

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