Created
May 26, 2020 18:16
-
-
Save vladfr/829ea760047e1655df986679eeac4813 to your computer and use it in GitHub Desktop.
kubectl shell completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Bash - OSX | |
# Get bash-completion going | |
$ brew install bash-completion | |
$ echo "[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion" >> ~/.bash_profile | |
# Put this in ~/.bash_profile | |
source <(kubectl completion bash) | |
alias k=kubectl | |
complete -F __start_kubectl k | |
# And reload your shell: | |
$ source ~/.bash_profile | |
## ZSH | |
# Put this in ~/.zshrc | |
autoload -Uz compinit && compinit # skip if you have oh-my-zsh | |
alias k=kubectl | |
# and run: | |
$ echo "[[ $commands[kubectl] ]] && source <(kubectl completion zsh)" >> ~/.zshrc | |
# And reload your shell | |
$ exec zsh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment