переход на bubble tea библиотеку

This commit is contained in:
2026-10-24 00:19:30 +03:00
parent 03a32ba6a8
commit ee9a1597a0
6 changed files with 217 additions and 166 deletions
+11 -7
View File
@@ -1,13 +1,17 @@
// Package suggestions
package suggestions
import "github.com/c-bata/go-prompt"
import "strings"
var defaultSuggestions = []prompt.Suggest{
{Text: "exit", Description: "Exit from shell"},
}
var defaultSuggestions = []string{"exit"}
func Completer(d prompt.Document) []prompt.Suggest {
// Если пользователь уже начал что-то писать, фильтруем список
return prompt.FilterHasPrefix(defaultSuggestions, d.GetWordBeforeCursor(), true)
func Completer(in string) []string {
if in=="" {return nil}
var matched []string
for _,cmd := range defaultSuggestions {
if strings.HasPrefix(cmd,in){
matched=append(matched, cmd)
}
}
return matched
}