template

package
v0.0.0-...-c00a100 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Answers

type Answers map[string]map[string]interface{}

Answers define project-specific settings.

type Config

type Config struct {
	Version ConfigVersion `toml:"version"`
}

Config defines Tribble-specific project template settings.

type ConfigVersion

type ConfigVersion int

ConfigVersion indicates project template settings compatibility. Currently only one version is defined: 0

const (
	V0 ConfigVersion = iota // unstable / experimental
)

type Project

type Project interface {
	MkdirAll(path string, perm os.FileMode) error
	WriteFile(path string, data []byte, perm os.FileMode) error
}

type Question

type Question struct {
	Prompt   string      `toml:"prompt"`
	Type     string      `toml:"type,omitempty"`
	Default  interface{} `toml:"default"`
	Required bool        `toml:"required"`
}

Question is a project-specific setting.

func (*Question) Lint

func (q *Question) Lint() (errors, warnings []string)

type Questions

type Questions map[string]map[string]*Question

Questions are a collection of project-specific settings.

type Template

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

func New

func New(fs billy.Filesystem) *Template

func Open

func Open(ctx context.Context, url, refname string) (t *Template, err error)

func (*Template) Clone

func (t *Template) Clone(p Project) error

func (*Template) Initialize

func (t *Template) Initialize(force bool) error

Initialize creates the files required for a project template.

func (*Template) LoadConfig

func (t *Template) LoadConfig() (*Config, error)

LoadConfig reads Tribble-specific project template settings.

func (*Template) LoadQuestions

func (t *Template) LoadQuestions() (Questions, error)

LoadQuestions reads Tribble-specific project template settings.

func (*Template) Origin

func (t *Template) Origin(dst string) (url, refname string, err error)

func (*Template) SaveConfig

func (t *Template) SaveConfig(c *Config, force bool) error

SaveConfig writes Tribble-specific project template settings.

func (*Template) SaveQuestions

func (t *Template) SaveQuestions(q *Questions, force bool) error

SaveQuestions writes Tribble-specific project template settings.

Jump to

Keyboard shortcuts

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