eks-anywhere
eks-anywhere copied to clipboard
eksctl anywhere completion bash does not work
I am trying to set up bash completion for eksctl anywhere using source <(eksctl anywhere completion bash)
, but it doesn't seem to work. Bash doesn't actually complete anything.
I can see that eksctl anywhere completion bash
returns the relevant output, but it seems to be unused when sourced...
To reproduce it, just run source <(eksctl anywhere completion bash)
, then start typing eksctl anywhere <tab><tab>
.
EKS Anywhere Release: 0.7.2
eksctl version: 0.86.0
OS: Using Linux Ubuntu 20.04.4 LTS (Focal Fossa)
and macOS Monterey 12.2.1
, but this issue occurs on any bash.
If your run eksctl completion bash
it has no details for anywhere. It would be nice if eksctl would request details from the plugin, but that may not be possible.
The eksctl anywhere completion bash
generates only a basic framework that doesn't even include top level flags.
The shell completion script for eksctl-anywhere
appears to generate completions for the anywhere
command NOT eksctl anywhere
. Therefore, completions don't appear when typing eksctl anywhere <tab><tab>
.
As a simple work around, creating an alias anywhere='eksctl anywhere'
allows you to use the completions by typing anywhere <tab><tab>
.
I have the following in my .bashrc
file:
if command -v eksctl &>/dev/null; then
source <(eksctl completion bash)
if command -v eksctl-anywhere &>/dev/null; then
source <(eksctl anywhere completion bash)
alias anywhere='eksctl anywhere'
fi
fi
Typing anywhere <tab> <tab>
then gives me the following:
$ anywhere
apply (Apply resources)
check-images (Check images used by EKS Anywhere do exist in the target registry)
completion (Generate the autocompletion script for the specified shell)
create (Create resources)
delete (Delete resources)
describe (Describe resources)
download (Download resources)
generate (Generate resources)
get (Get resources)
help (Help about any command)
import-images (Push EKS Anywhere images to a private registry)
import (Import resources)
install (Install resources to the cluster)
list (List resources)
upgrade (Upgrade resources)
version (Get the eksctl anywhere version)
I'm no expert on shell completion, so if there is a better way, please let me know.
Hopefully, the workaround above will help out until a proper fix is in place.