fix(tests): fix all problems related to test

This commit is contained in:
verse91
2026-05-09 23:37:13 +07:00
parent 17f33ff480
commit e587f02798
11 changed files with 301 additions and 172 deletions
+2 -3
View File
@@ -20,8 +20,6 @@ func GetAlias(name string) (string, bool) {
func Lookup(input string) []Suggestion {
if shell.Current != nil {
ShellAliases = shell.Current.ScanAliases()
} else {
ShellAliases = make(map[string]string)
}
if input == "" {
@@ -83,6 +81,7 @@ func Lookup(input string) []Suggestion {
rootCmdName := tokens[0]
spec, exists := Registry[rootCmdName]
debugLog("[core] lookup tokens: %v, registry exists: %v", tokens, exists)
if !exists {
return nil
}
@@ -226,7 +225,7 @@ func Lookup(input string) []Suggestion {
}
}
if len(partial) > 0 && partial[0] == '-' {
if partial == "" || (len(partial) > 0 && partial[0] == '-') {
usedOpts := make(map[string]bool)
for _, t := range tokens {
if strings.HasPrefix(t, "-") {
+9
View File
@@ -22,8 +22,17 @@ func Tokenize(s string) []string {
inQuote := false
var quoteChar rune
escaped := false
for _, c := range s {
if escaped {
current.WriteRune(c)
escaped = false
continue
}
switch {
case c == '\\':
escaped = true
case !inQuote && (c == '"' || c == '\''):
inQuote = true
quoteChar = c