template

package
v0.0.0-...-e8b59ad Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManifestVersion1 = "1"
	VarTypeString    = "string"
	VarTypeSelect    = "select"
)

Variables

View Source
var (
	ErrUnexpectedOverwriteStrategy = errors.New("unexpected overwrite strategy")
)

Functions

func CopyDir

func CopyDir(vfs billy.Filesystem, baseDir string, dst string, opts *Option) error

func CopyFile

func CopyFile(vfs billy.Filesystem, src, dst string, opts *Option) (err error)

func Prompt

func Prompt(manifest *Manifest, data Data) error

Types

type Constraint

type Constraint struct {
	Rule    string `yaml:"rule"`
	Message string `yaml:"message"`
}

type Data

type Data map[string]interface{}

type Manifest

type Manifest struct {
	Version string `yaml:"version"`
	Vars    []Var  `yaml:"vars"`
}

func Load

func Load(r io.Reader) (*Manifest, error)

func (*Manifest) Validate

func (m *Manifest) Validate() error

type Option

type Option struct {
	IgnorePatterns    []string
	TemplateData      Data
	TemplateExt       string
	Unnattended       bool
	PreferredStrategy Strategy
}

type Strategy

type Strategy int
const (
	Undefined Strategy = -1
	Overwrite Strategy = iota
	CopyAsDist
	DoNotCopy
)

type Var

type Var struct {
	Type        string       `yaml:"type"`
	Name        string       `yaml:"name"`
	Description string       `yaml:"description"`
	Default     string       `yaml:"default"`
	Constraints []Constraint `yaml:"constraints"`
	Items       []string     `yaml:"items"`
}

Jump to

Keyboard shortcuts

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