template

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2018 License: MIT Imports: 31 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",
	"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

func BuildSurvey added in v0.8.2

func BuildSurvey(s *Survey) ([]*survey.Question, error)

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

Types

type CommandData added in v0.0.19

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

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 SetConfigName added in v0.0.14

func SetConfigName(s string) Option

SetConfigName option.

func WithButlerVersion added in v0.0.32

func WithButlerVersion(s string) Option

WithButlerVersion option.

func WithCommandData added in v0.0.19

func WithCommandData(cd *CommandData) Option

WithCommandData option.

func WithCwd added in v0.3.0

func WithCwd(dir string) Option

WithCwd option.

func WithTemplateSurveyResults added in v0.0.21

func WithTemplateSurveyResults(sr map[string]interface{}) Option

WithTemplateSurveyResults option.

func WithTemplates

func WithTemplates(s []config.Template) Option

WithTemplates option.

func WithVariables

func WithVariables(s map[string]interface{}) Option

WithVariables 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

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

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 New

func New(options ...Option) *Templating

New with the given options.

func (*Templating) Run

func (t *Templating) Run() (err error)

Run the command

func (*Templating) StartCommandSurvey added in v0.0.19

func (t *Templating) StartCommandSurvey() error

StartCommandSurvey ask the user for the template

Jump to

Keyboard shortcuts

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