Documentation ¶
Index ¶
- Variables
- func BuildSurvey(s *Survey) ([]*survey.Question, error)
- type CommandData
- type Hook
- type Option
- func SetConfigName(s string) Option
- func WithButlerVersion(s string) Option
- func WithCommandData(cd *CommandData) Option
- func WithCwd(dir string) Option
- func WithTemplateSurveyResults(sr map[string]interface{}) Option
- func WithTemplates(s []config.Template) Option
- func WithVariables(s map[string]interface{}) Option
- type Question
- type Survey
- type TaskTracker
- type TemplateData
- type Templating
Constants ¶
This section is empty.
Variables ¶
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
var ExcludedDirs = []string{
"node_modules",
"bower_components",
"jspm_packages",
"log",
"logs",
"bin",
}
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 ¶
Types ¶
type CommandData ¶ added in v0.0.19
CommandData contains all project data
type Hook ¶ added in v0.0.19
type Hook struct { Name string `json:"name" validate:"required"` Cmd string `json:"cmd" validate:"required"` Args []string `json:"args"` Verbose bool `json:"verbose"` Enabled string `json:"enabled"` Required bool `json:"required"` }
Hook represent a hook in the yml file
type Option ¶
type Option func(*Templating)
Option function.
func WithButlerVersion ¶ added in v0.0.32
WithButlerVersion option.
func WithCommandData ¶ added in v0.0.19
func WithCommandData(cd *CommandData) Option
WithCommandData option.
func WithTemplateSurveyResults ¶ added in v0.0.21
WithTemplateSurveyResults option.
type Question ¶ added in v0.0.14
type Question struct { Type string `json:"type" validate:"required"` Name string `json:"name" validate:"required"` Default interface{} `json:"default"` Options []string `json:"options"` Message string `json:"message" validate:"required"` Required bool `json:"required"` Help string `json:"help"` }
Question represents a question in the yml file
type Survey ¶ added in v0.0.14
type Survey struct { Questions []Question `yaml:"questions" validate:"required,dive"` AfterHooks []Hook `yaml:"afterHooks"` Variables map[string]interface{} `yaml:"variables"` ButlerVersion string `yaml:"butlerVersion"` Deprecated bool `yaml:"deprecated"` }
Survey represents in the yml file
func ReadSurveyConfig ¶ added in v0.0.14
ReadSurveyConfig reads the config and return a new survey
type TaskTracker ¶ added in v0.0.25
type TaskTracker struct {
// contains filtered or unexported fields
}
TaskTracker help you to track the execution time of tasks and generate a summary for the cli
func NewTaskTracker ¶ added in v0.0.25
func NewTaskTracker() *TaskTracker
NewTaskTracker create a new tracker
func (*TaskTracker) PrintSummary ¶ added in v0.0.25
func (t *TaskTracker) PrintSummary(output io.Writer)
PrintSummary print the summary on stdout
func (*TaskTracker) Track ¶ added in v0.0.25
func (t *TaskTracker) Track(name string)
Track the duration of the task
func (*TaskTracker) UnTrack ¶ added in v0.0.25
func (t *TaskTracker) UnTrack(name string)
UnTrack measure the duration in seconds
type TemplateData ¶ added in v0.0.18
type TemplateData struct { Project *CommandData Date string Year int Vars map[string]interface{} }
TemplateData basic template data
type Templating ¶
type Templating struct { Templates []config.Template Variables map[string]interface{} CommandData *CommandData TemplateData *TemplateData TaskTracker *TaskTracker // contains filtered or unexported fields }
Templating command
func (*Templating) StartCommandSurvey ¶ added in v0.0.19
func (t *Templating) StartCommandSurvey() error
StartCommandSurvey ask the user for the template