Unverified Commit 5b717ab3 authored by IsThisTheMatrix's avatar IsThisTheMatrix Committed by GitHub
Browse files

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

parent 53cbd658
......@@ -150,19 +150,13 @@ alias kepvc='kubectl edit pvc'
alias kdpvc='kubectl describe pvc'
alias kdelpvc='kubectl delete pvc'
# Colored JSON output
kj() {
kubectl "$@" -o json | jq
}
compdef kj=kubectl
kjx() {
kubectl "$@" -o json | fx
}
compdef kjx=kubectl
# Only run if the user actually has kubectl installed
if (( $+commands[kubectl] )); then
kj() { kubectl "$@" -o json | jq; }
kjx() { kubectl "$@" -o json | fx; }
ky() { kubectl "$@" -o yaml | yh; }
# Colored YAML output
ky() {
kubectl "$@" -o yaml | yh
}
compdef ky=kubectl
compdef kj=kubectl
compdef kjx=kubectl
compdef ky=kubectl
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment