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' ...@@ -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
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