Repository navigation
Shell Auto completion
- Upgrade
kubectl tmux-execto v0.4.0 or later. - Upgrade
kubectlto v1.26.0 or later. -
Enable the shell completion of
kubectl. - If the plugin is installed by Krew, follow the additional steps.
Here are the steps to enable it in your terminal.
Run the following command to check the version of the plugin.
kubectl tmux-exec --versionThe version in the output must be 0.4.0 or later, for example:
0.5.0 (commit = ...)If it is not, upgrade the plugin in the same way it was installed.
brew upgrade kubectl-tmux-execkubectl krew upgrade tmux-execDownload the latest release.
kubectl version --clientThe Client Version in the output must be v1.26.0 or later. Earlier versions do not support completion for plugins.
Client Version: v1.26.0
Kustomize Version: v4.5.7If it is not, follow the official guide to upgrade kubectl.
The plugin completion is provided through the completion of kubectl itself, so it must be enabled first. Add the line for your shell to its startup file and restart the shell.
source <(kubectl completion bash)This requires the bash-completion package.
source <(kubectl completion zsh)kubectl completion fish | sourceSee the kubectl documentation for more details. Run kubectl get <TAB> to check that it works.
which kubectl_complete-tmux_execThe output should look like this:
/usr/local/bin/kubectl_complete-tmux_execKrew does not add the completion script to the PATH (see this issue for more information), so a symbolic link has to be created manually.
Replace v0.5.0 with the version you are using. Run ls "${KREW_ROOT:-$HOME/.krew}/store/tmux-exec/" to find it.
ln -sf "${KREW_ROOT:-$HOME/.krew}/store/tmux-exec/v0.5.0/bin/kubectl_complete-tmux_exec" "${KREW_ROOT:-$HOME/.krew}/bin/kubectl_complete-tmux_exec"Then run which kubectl_complete-tmux_exec again to check that it is on the PATH.
Krew removes the old version after an upgrade, so run the command again with the new version after each kubectl krew upgrade tmux-exec.
Type kubectl tmux-exec -- and press Tab. The options of the plugin should be listed.
Global flags of kubectl must come after the plugin name. For example, kubectl tmux-exec -n foo <TAB> works, but kubectl -n foo tmux-exec <TAB> does not.
If nothing is listed, run the following command to see what kubectl returns:
kubectl __complete tmux-exec ''