template

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2018 License: MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BinaryFileExt = []string{}/* 244 elements not displayed */

BinaryFileExt is a list of common binary files. Usually they aren't shipped with the template but could lead to a crash. Source: https://github.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json

View Source
var ExcludedDirs = []string{
	"node_modules",
	"bower_components",
	"jspm_packages",
	"dist",
	"build",
	"log",
	"logs",
	"bin",
	"lib",
	"typings",
}

ExcludedDirs is a list of common directorys which are used store application files Usually they aren't shipped with the template but could lead to a crash.

Functions

func BuildSurveys added in v0.0.14

func BuildSurveys(butlerSurveys ...*Survey) ([]*survey.Question, error)

BuildSurveys generates a list of survey questions based on the template survey

Types

type Option

type Option func(*Templating)

Option function.

func SetConfigName added in v0.0.14

func SetConfigName(s string) Option

SetConfigName option.

func WithTemplates

func WithTemplates(s []config.Template) Option

WithTemplates option.

func WithVariables

func WithVariables(s map[string]string) Option

WithVariables option.

type ProjectData

type ProjectData struct {
	Name        string
	Path        string
	Template    string
	Description string
}

ProjectData contains all project data

type Question added in v0.0.14

type Question struct {
	Type     string      `json:"type"`
	Name     string      `json:"name"`
	Default  interface{} `json:"default"`
	Options  []string    `json:"options"`
	Message  string      `json:"message"`
	Required bool        `json:"required"`
	Help     string      `json:"help"`
}

type Survey added in v0.0.14

type Survey struct {
	Questions []Question `json:"questions"`
}

func ReadSurveyConfig added in v0.0.14

func ReadSurveyConfig(path string) (*Survey, error)

ReadSurveyConfig reads the config and return a new survey

type Templating

type Templating struct {
	Templates []config.Template
	Variables map[string]string
	// contains filtered or unexported fields
}

Templating command

func New

func New(options ...Option) *Templating

New with the given options.

func (*Templating) GetQuestions added in v0.0.14

func (t *Templating) GetQuestions() []*survey.Question

GetQuestions return all required prompts

func (*Templating) Run

func (t *Templating) Run() error

Run the command

func (*Templating) Skip added in v0.0.14

func (t *Templating) Skip(path string, info os.FileInfo) (bool, error)

Skip returns an error when a directory should be skipped or true with a file

Jump to

Keyboard shortcuts

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