template

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MLnone file does not have a mode line.
	MLnone = iota
	// MLrender file mode line instruction to render.
	MLrender
	// MLnorender file mode line instruction not to render.
	MLnorender
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Checkvars      *checkvars.Check             // Not required
	Client         *client.Client               `validate:"required"`
	Config         *config.File                 `validate:"required"`
	Errs           *errs.Handler                `validate:"required"`
	Exit           *exit.Handler                `validate:"required"`
	Log            logger.OutputIface           `validate:"required"`
	NoUnset        bool                         // No unset variables
	NoEmpty        bool                         // No empty variables
	RenderCurrent  string                       `validate:"required"`
	RenderersAvail map[string]renderer.Renderer `validate:"required"`
	Stderr         io.Writer                    `validate:"required"`
	Stdout         io.Writer                    `validate:"required"`
	TemplateDir    string                       `validate:"required"`
	Variables      *variables.Variables         // Not required
	ModeLineLen    uint8
}

Options options to constructor

type Template

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

Template the template itself

func New

func New(opts *Options) *Template

New *Template constructor

func (*Template) Run

func (t *Template) Run() int

Run generates the target directory structure

func (*Template) SetDest

func (t *Template) SetDest(dest string)

SetDest sets the destination path

func (*Template) SetRender

func (t *Template) SetRender(renderer string)

SetRender set rendering engine

func (*Template) SetSrc

func (t *Template) SetSrc(name string)

SetSrc sets the source template "name". "name" is defined in *config.Config.TemplateURLs. *config.Config is provided as an Option to New.

func (*Template) SetSrcDest

func (t *Template) SetSrcDest(src, dest string)

SetSrcDest sets the source template and destination path where the project structure will reside.

func (*Template) SetVars

func (t *Template) SetVars(vars *variables.Variables)

type TemplateIface

type TemplateIface interface {
	// SetRender set rendering engine
	SetRender(renderer string)
	SetVars(vars *variables.Variables)
	// SetSrcDest sets the source template and destination path where the project structure
	// will reside.
	SetSrcDest(src, dest string)
	// SetSrc sets the source template "name". "name" is defined
	// in *config.Config.TemplateURLs. *config.Config is provided as an Option to New.
	SetSrc(name string)
	// SetDest sets the destination path
	SetDest(dest string)
	// Run generates the target directory structure
	Run() int
}

TemplateIface ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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