mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-15 01:48:34 -07:00
fix(kubectl): fix kubectl completion for kj
, kjx
and ky
aliases (#12566)
This commit is contained in:
parent
b1e3a82bb5
commit
8127e5838c
@ -180,11 +180,23 @@ alias kej='kubectl edit job'
|
|||||||
alias kdj='kubectl describe job'
|
alias kdj='kubectl describe job'
|
||||||
alias kdelj='kubectl delete job'
|
alias kdelj='kubectl delete job'
|
||||||
|
|
||||||
function kj() { kubectl "$@" -o json | jq; }
|
# Utility print functions (json / yaml)
|
||||||
function kjx() { kubectl "$@" -o json | fx; }
|
function _build_kubectl_out_alias {
|
||||||
function ky() { kubectl "$@" -o yaml | yh; }
|
setopt localoptions norcexpandparam
|
||||||
if (( ${+functions[compdef]} )); then
|
|
||||||
compdef _kubectl kj
|
# alias function
|
||||||
compdef _kubectl kjx
|
eval "function $1 { $2 }"
|
||||||
compdef _kubectl ky
|
|
||||||
fi
|
# completion function
|
||||||
|
eval "function _$1 {
|
||||||
|
words=(kubectl \"\${words[@]:1}\")
|
||||||
|
_kubectl
|
||||||
|
}"
|
||||||
|
|
||||||
|
compdef _$1 $1
|
||||||
|
}
|
||||||
|
|
||||||
|
_build_kubectl_out_alias "kj" 'kubectl "$@" -o json | jq'
|
||||||
|
_build_kubectl_out_alias "kjx" 'kubectl "$@" -o json | fx'
|
||||||
|
_build_kubectl_out_alias "ky" 'kubectl "$@" -o yaml | yh'
|
||||||
|
unfunction _build_kubectl_out_alias
|
||||||
|
Loading…
Reference in New Issue
Block a user