templates

package
v0.0.0-...-7f7efcf Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTemplatedStr

func GetTemplatedStr(text *string, obj interface{}) (string, error)

Types

type DirTemplate

type DirTemplate struct {
	Path string
	Mode os.FileMode
}

DirTemplate stores a single directory template

func (*DirTemplate) Instantiate

func (d *DirTemplate) Instantiate(destDir string, ctx interface{}) error

Instantiate instantiates file template

type FileTemplate

type FileTemplate struct {
	Path    string
	Mode    os.FileMode
	Content string
}

FileTemplate stores a single file template

func (*FileTemplate) Instantiate

func (t *FileTemplate) Instantiate(destDir string, ctx interface{}) error

Instantiate instantiates file template

type FileTreeTemplate

type FileTreeTemplate struct {
	Files []FileTemplate
	Dirs  []DirTemplate
}

FileTreeTemplate stores filetree template

func Combine

func Combine(tmplts ...FileTreeTemplate) *FileTreeTemplate

Combine combines two file tree templates

func (*FileTreeTemplate) AddDirs

func (tmpl *FileTreeTemplate) AddDirs(dirTemplates ...DirTemplate)

AddDirs adds dirs to tree template

func (*FileTreeTemplate) AddFiles

func (tmpl *FileTreeTemplate) AddFiles(fileTemplates ...FileTemplate)

AddFiles adds files to tree template

func (*FileTreeTemplate) Instantiate

func (tmpl *FileTreeTemplate) Instantiate(destDir string, ctx interface{}) error

Instantiate instantiates file tree template

type Template

type Template interface {
	Instantiate(destDir string, ctx interface{}) error
}

Template is the interface that has Instantiate method

Jump to

Keyboard shortcuts

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