Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultTemplateName = gitmojiCommandTemplateName
DefaultTemplateName is the name of the template to use if when no template is specified.
var TemplateLookup = make(map[string]CommandTemplate, 2)
TemplateLookup maps template names to templates.
Functions ¶
func GetTemplateMessage ¶ added in v1.1.0
func GetTemplateMessage(tpl CommandTemplate) string
GetTemplateMessage prompts the user for the teamplate prompts and then returns the result of formatting the "Messages" into a string.
func LoadTemplates ¶
func LoadTemplates(templates map[string]interface{})
LoadTemplates reads a map of template names to basic data types and populates TemplateLookup with the result.
func RunTemplateCommand ¶ added in v1.1.0
func RunTemplateCommand(tpl CommandTemplate)
RunTemplateCommand prompts the user for the template prompts and then runs the command specified in the template.
Types ¶
type CommandTemplate ¶
type CommandTemplate struct { Prompts []Prompt Command string CommandArgs []string Messages []string }
CommandTemplate represents a command to execute and user prompts to get the command arguments.
type Prompt ¶
type Prompt struct { Type string `yaml:"Type"` Mandatory bool `yaml:"Mandatory,omitempty"` Prompt string `yaml:"Prompt,omitempty"` Name string `yaml:"Name"` Condition string `yaml:"Condition,omitempty"` Choices []PromptChoice `yaml:"Choices,omitempty"` }
Prompt defines a question to ask the user.
type PromptChoice ¶
PromptChoice defines a single option in a multiple-choice prompt.