kubectl: verify kubectl is installed before running compdef (#9346)

master
IsThisTheMatrix 6 years ago committed by GitHub
parent 53cbd658f5
commit 5b717ab3e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      plugins/kubectl/kubectl.plugin.zsh

@ -150,19 +150,13 @@ alias kepvc='kubectl edit pvc'
alias kdpvc='kubectl describe pvc' alias kdpvc='kubectl describe pvc'
alias kdelpvc='kubectl delete pvc' alias kdelpvc='kubectl delete pvc'
# Colored JSON output # Only run if the user actually has kubectl installed
kj() { if (( $+commands[kubectl] )); then
kubectl "$@" -o json | jq kj() { kubectl "$@" -o json | jq; }
} kjx() { kubectl "$@" -o json | fx; }
compdef kj=kubectl ky() { kubectl "$@" -o yaml | yh; }
kjx() {
kubectl "$@" -o json | fx
}
compdef kjx=kubectl
# Colored YAML output compdef kj=kubectl
ky() { compdef kjx=kubectl
kubectl "$@" -o yaml | yh compdef ky=kubectl
} fi
compdef ky=kubectl

Loading…
Cancel
Save