return chosen, suggestions
}
+// OptionValueComplete completes values for various options
func OptionValueComplete(inputOpt, input string) (string, []string) {
inputOpt = strings.TrimSpace(inputOpt)
var suggestions []string
if strings.HasPrefix("dos", input) {
suggestions = append(suggestions, "dos")
}
+ case "sucmd":
+ if strings.HasPrefix("sudo", input) {
+ suggestions = append(suggestions, "sudo")
+ }
+ if strings.HasPrefix("doas", input) {
+ suggestions = append(suggestions, "doas")
+ }
}
}
return
}
+// PluginCmdComplete completes with possible choices for the `> plugin` command
func PluginCmdComplete(input string) (chosen string, suggestions []string) {
for _, cmd := range []string{"install", "remove", "search", "update", "list"} {
if strings.HasPrefix(cmd, input) {
return chosen, suggestions
}
+// PluginnameComplete completes with the names of loaded plugins
func PluginNameComplete(input string) (chosen string, suggestions []string) {
for _, pp := range GetAllPluginPackages() {
if strings.HasPrefix(pp.Name, input) {