Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Completer = func(document prompt.Document) (suggests []prompt.Suggest) { command := document.GetWordBeforeCursor() text := document.Text if strings.HasPrefix(text, "run ") { for _, plan := range Config.Plans { suggests = append(suggests, prompt.Suggest{Text: plan.Name, Description: plan.Description}) sort.Slice(suggests, func(i, j int) bool { x := strings.Compare(suggests[i].Text, suggests[j].Text) return x < 0 }) } return prompt.FilterFuzzy(suggests, command, true) } return prompt.FilterHasPrefix(baseSuggests, command, true) }
Completer determines the suggestions shown to the user
View Source
var Config model.Config
Config represents the content of the yaml file used to define what this app is capable of doing
View Source
var Executor = func(command string) { if strings.HasPrefix(command, "run ") { planName := command[len("run "):] if plan, ok := Config.Plans[planName]; ok { executePlan(plan) return } fmt.Printf("Plan %s not found\n", planName) } if function, ok := baseFunctions[command]; ok { function() } else { fmt.Println("Command not found!") } }
Executor determines which what to do with the given command
Functions ¶
func ExtractPlans ¶
ExtractPlans takes the location of the yaml file and delegats it's content to the method reading the content and extracting the plans.
func InitializePlans ¶
func InitializePlans() (err error)
InitializePlans creates the global config instance that creates the plans definitions
Can also be used to update the available plans.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.