template

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: ISC Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Append

type Append struct {
	Filepath string `yaml:"filepath"`
	Content  string `yaml:"content"`
}

Append is used for adding content to files.

type Appends

type Appends []Append

Appends is the type for a slice of Append type.

type Changes

type Changes struct {
	Deletes  Deletes  `yaml:"deletes"`
	Moves    Moves    `yaml:"moves"`
	Appends  Appends  `yaml:"appends"`
	Replaces Replaces `yaml:"replaces"`
}

Changes define all the required changes for a template.

type Delete

type Delete struct {
	Glob string
}

Delete is used for deteling files or directories.

type Deletes

type Deletes []Delete

Deletes is the type for a slice of Delete type.

type Move

type Move struct {
	Src  string `yaml:"src"`
	Dest string `yaml:"dest"`
}

Move is used for moving (renaming) a file or directory.

type Moves

type Moves []Move

Moves is the type for a slice of Move type.

type Replace

type Replace struct {
	Filepath string `yaml:"filepath"`
	Old      string `yaml:"old"`
	New      string `yaml:"new"`
}

Replace is used for replacing content in files.

type Replaces

type Replaces []Replace

Replaces is the type for a slice of Replace type.

type Service

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

Service

func NewService

func NewService(ui ui.UI) *Service

func (*Service) Execute

func (s *Service) Execute(template Template) error

Execute executes all changes defined for a template.

type Template

type Template struct {
	Name        string  `yaml:"name"`
	Description string  `yaml:"description"`
	Changes     Changes `yaml:"changes"`
	// contains filtered or unexported fields
}

Template has all specifications for a Basil code template.

func Read

func Read(path string, params interface{}) (Template, error)

Read reads template specifications from a file in a path.

Jump to

Keyboard shortcuts

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