Autocomplete breaks when multiple longer contexts match
I have multiple contexts from AWS clusters, which by default have the entire cluster ARN as their context name (e.g. arn:aws:eks:us-east-2:112233445566:cluster/my-cluster-in-aws).
If I try to autocomplete with only one matching context, then everything works fine, however, if there are multiple matching contexts (e.g. hitting TAB after typing arn:aws), it will autocomplete until the first diverging character and no list of options will come up on a second press. Typing any further characters that match one of the options does not allow autocompleting the context name either.
Example:
Let us assume there is two contexts and we try to autocomplete.
$ kubectx
arn:aws:eks:us-east-2:112233445566:cluster/my-cluster-in-aws
arn:aws:eks:us-west-2:112233445566:cluster/my-cluster-in-aws-two
$ kubectx arn
Now I hit TAB to autocomplete.
$ kubectx arn:aws:eks:us-
Another TAB hit does nothing at this point. The two options are not shown. I type an 'e' to only match the first context.
$ kubectx arn:aws:eks:us-e
Pressing TAB now does nothing anymore, the first context is not autocompleted.
I am aware I can rename the contexts. If I rename to use shorter names, then everything works fine. I have also tested the presence of the slash in the context name. Removing that has no effect. If there is only a single match of such a length, the autocomplete works without issues.
- are you using bash or zsh
- are you using the Go implementation or the bash script implementation of kubectx? (
vi $(which kubectx)can help find).
I'm not observing this behavior with the bash script implementation+zsh with the context names you pasted.
- bash
- Go implementation (version 0.9.5)