2
2
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:
sammyette 2023-02-07 15:48:59 -04:00
parent 61914f8dc7
commit f2ee600c28
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD

View File

@ -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