mirror of https://github.com/Hilbis/Hilbish
fix: check for 0 length slice when splitting input for completions
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) {
|
func fileComplete(query, ctx string, fields []string) ([]string, string) {
|
||||||
q := splitForFile(ctx)
|
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) {
|
func binaryComplete(query, ctx string, fields []string) ([]string, string) {
|
||||||
q := splitForFile(ctx)
|
q := splitForFile(ctx)
|
||||||
query = q[len(q) - 1]
|
query = ""
|
||||||
|
if len(q) != 0 {
|
||||||
|
query = q[len(q) - 1]
|
||||||
|
}
|
||||||
|
|
||||||
var completions []string
|
var completions []string
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue