Forked from idcrook/bashrc_kubernetes_alias_completions.sh
Created
August 17, 2018 20:28
-
-
Save TheMetaphysicalCrook/382496d9a0b1569f24216250f7353c97 to your computer and use it in GitHub Desktop.
Shell command line expansion from kubernetes aliases; even complete in system namespace if bash alias uses that
This file contains hidden or 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
# source kubectl bash completions | |
if hash kubectl 2>/dev/null; then | |
source <(kubectl completion bash) | |
fi | |
# the magic via https://github.com/cykerway/complete-alias | |
# seems to require BASH 4; install bash from Homebrew and make its BASH 4 the default user shell in macOS | |
# mkdir ~/.bash_completion.d | |
# curl -o ~/.bash_completion.d/bash_complete-alias.sh https://raw.githubusercontent.com/cykerway/complete-alias/master/completions/bash_completion.sh | |
if [ -f ~/.bash_completion.d/bash_complete-alias.sh ] ; then | |
. ~/.bash_completion.d/bash_complete-alias.sh | |
fi | |
# in ~/.bash_aliases (that gets sourced by ~/.bashrc) | |
# kubernetes | |
alias kbk="kubectl" | |
alias kbn="kubectl --namespace=kube-system" | |
# _complete_alias requires https://github.com/cykerway/complete-alias to be loaded | |
complete -F _complete_alias kbk | |
complete -F _complete_alias kbn | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment