mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-19 20:29:45 +01:00
kubectl: verify kubectl is installed before running compdef (#9346)
This commit is contained in:
parent
53cbd658f5
commit
5b717ab3e4
1 changed files with 9 additions and 15 deletions
|
@ -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; }
|
||||||
|
ky() { kubectl "$@" -o yaml | yh; }
|
||||||
|
|
||||||
compdef kj=kubectl
|
compdef kj=kubectl
|
||||||
|
|
||||||
kjx() {
|
|
||||||
kubectl "$@" -o json | fx
|
|
||||||
}
|
|
||||||
compdef kjx=kubectl
|
compdef kjx=kubectl
|
||||||
|
|
||||||
# Colored YAML output
|
|
||||||
ky() {
|
|
||||||
kubectl "$@" -o yaml | yh
|
|
||||||
}
|
|
||||||
compdef ky=kubectl
|
compdef ky=kubectl
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in a new issue