scaffold

package
v0.0.0-...-c845b1b Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Modifiers = map[string]func(string) string{
	"titlecase": cases.Title(language.English).String,
	"lowercase": strings.ToLower,
	"uppercase": strings.ToUpper,
}

Functions

func ApplyTemplate

func ApplyTemplate(src io.Reader, dst io.Writer, replacer func(string) string) (checksum string, err error)

func Generate

func Generate(lockfile *config.Lockfile, scaffoldSource, outdir string) error

func LiteralMatchReplacer

func LiteralMatchReplacer(manifest *config.Manifest, vars map[string]string) func(string) string

LiteralMatchReplacer returns a function that will perform template replacement on a string or substring, using the configured delimiters and vars. This function supports zero or one modifiers per variable.

func LoadVarsInteractive

func LoadVarsInteractive(manifestVars map[string]*config.ManifestVar, lockfileVars map[string]string) (map[string]string, error)

LoadVarsInteractive loads vars from lockfile, and prompts the user for any vars that are in the manifest but not in the lockfile.

func RegexpLoopReplacer

func RegexpLoopReplacer(manifest *config.Manifest, vars map[string]string) (func(string) string, error)

func RegexpReplacer

func RegexpReplacer(manifest *config.Manifest, vars map[string]string) (func(string) string, error)

func Remove

func Remove(lockfile *config.Lockfile, scaffoldSource, outdir string) error

func Upgrade

func Upgrade(lockfile *config.Lockfile, scaffoldSource, outdir string) error

Types

type Scaffold

type Scaffold struct {
	Files    []ScaffoldFile
	Manifest *config.Manifest
	Vars     map[string]string
}

func LoadFromDir

func LoadFromDir(dirName string) (*Scaffold, error)

type ScaffoldFile

type ScaffoldFile struct {
	// RelativePath is the file path relative to the root of the scaffold directory
	RelativePath string
	// FullPath is the absolute path to the file
	FullPath string
}

Jump to

Keyboard shortcuts

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