mirror of
https://github.com/Hilbis/Hilbish
synced 2025-04-01 11:13:24 +00:00
fix: check for 0 length slice when splitting input for completions
This commit is contained in:
parent
61914f8dc7
commit
f2ee600c28
11
complete.go
11
complete.go
@ -74,13 +74,20 @@ func splitForFile(str string) []string {
|
||||
|
||||
func fileComplete(query, ctx string, fields []string) ([]string, string) {
|
||||
q := splitForFile(ctx)
|
||||
path := ""
|
||||
if len(q) != 0 {
|
||||
path = q[len(q) - 1]
|
||||
}
|
||||
|
||||
return matchPath(q[len(q) - 1])
|
||||
return matchPath(path)
|
||||
}
|
||||
|
||||
func binaryComplete(query, ctx string, fields []string) ([]string, string) {
|
||||
q := splitForFile(ctx)
|
||||
query = q[len(q) - 1]
|
||||
query = ""
|
||||
if len(q) != 0 {
|
||||
query = q[len(q) - 1]
|
||||
}
|
||||
|
||||
var completions []string
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user