Last active
November 25, 2018 12:35
-
-
Save lalyos/608452e2507c2b5cf57a525db684789c to your computer and use it in GitHub Desktop.
fix kubectl autocomplete
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
## usage: . <(curl -sL bit.ly/kubectl-fix) | |
if ! [[ "$KUBECTL_AUTOCOMP_FIXED" ]]; then | |
__kubectl_get_resource () { if [[ ${#nouns[@]} -eq 0 ]]; then local kubectl_out; if kubectl_out=$(kubectl api-resources $(__kubectl_override_flags) -o name --cached --verbs=get 2>/dev/null); then COMPREPLY=($( compgen -W "${kubectl_out[*]}" -- "$cur" )); return 0; fi; return 1; fi; __kubectl_parse_get "${nouns[${#nouns[@]} -1]}"; } | |
KUBECTL_AUTOCOMP_FIXED=1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment