template

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2018 License: MIT Imports: 27 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 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 {
	Cmd     string   `json:"cmd"`
	Args    []string `json:"args"`
	Enabled string   `json:"enabled"`
}

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 WithCommandData added in v0.0.19

func WithCommandData(cd *CommandData) Option

WithCommandData option.

func WithGitDir added in v0.0.21

func WithGitDir(dir string) Option

WithGitDir 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]string) Option

WithVariables option.

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"`
}

Question represents a question in the yml file

type Survey added in v0.0.14

type Survey struct {
	Questions  []Question        `yaml:"questions"`
	AfterHooks []Hook            `yaml:"afterHooks"`
	Variables  map[string]string `yaml:"variables"`
}

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]string
}

TemplateData basic template data

type Templating

type Templating struct {
	Templates    []config.Template
	Variables    map[string]string
	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) 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

func (*Templating) StartCommandSurvey added in v0.0.19

func (t *Templating) StartCommandSurvey() error

StartCommandSurvey collect all required informations from user

Jump to

Keyboard shortcuts

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