Closed jpcoenen closed 4 years ago
The Go runtime would panic at the following line because of an out-of-bounds slice access if autocompletion was requested for a clause that consumed the remainder of a command:
https://github.com/alecthomas/kingpin/blob/cf44c60659e38b5559aa885c13ad76c9bd6e8d50/cmd.go#L35
By specifically checking for these kinds of clauses, the problem should be mitigated.
Example
package main import "github.com/alecthomas/kingpin" func main() { var strings []string kingpin.Arg("test", "").StringsVar(&strings) kingpin.Parse() }
$ go run main.go --completion-bash 1 2 panic: runtime error: index out of range [1] with length 1
Thanks!
The Go runtime would panic at the following line because of an out-of-bounds slice access if autocompletion was requested for a clause that consumed the remainder of a command:
https://github.com/alecthomas/kingpin/blob/cf44c60659e38b5559aa885c13ad76c9bd6e8d50/cmd.go#L35
By specifically checking for these kinds of clauses, the problem should be mitigated.
Example