mixer

package
v0.0.0-...-b865a11 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Validators = map[string]func(string) error{
	"string": func(value string) error {
		return nil
	},
	"set": func(value string) error {
		return nil
	},
}

Functions

func Match

func Match(path string, patterns []string) bool

func MixerError

func MixerError(msg string) error

Types

type Config

type Config struct {
	Mix    MixConfig
	Params Parameters
}

type Context

type Context map[string]interface{}

func (Context) Render

func (ctx Context) Render(txt string) (string, error)

Render a template string using the current context

func (Context) RenderList

func (ctx Context) RenderList(list []string) ([]string, error)

RenderList render each string using the current context

type MixConfig

type MixConfig struct {
	Copy   []string
	Ignore []string
}

type Mixer

type Mixer struct {
	Path string
}

func New

func New(source string) Mixer

func (Mixer) Mix

func (m Mixer) Mix(target string) error

Mix reads the mixer, prompt the parameters to user

and then apply it the target

func (Mixer) TemplateRoot

func (m Mixer) TemplateRoot() string

type Parameter

type Parameter struct {
	Key     string
	Type    string
	Prompt  string
	Label   string
	Default interface{}
	Choices []string
	Multi   bool
}

func (Parameter) PromptUser

func (param Parameter) PromptUser(ctx Context) (interface{}, error)

type Parameters

type Parameters []Parameter

func (Parameters) PromptUser

func (params Parameters) PromptUser(ctx Context) Context

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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