first commit
This commit is contained in:
commit
0610f4aeab
130 changed files with 9897 additions and 0 deletions
41
fn/-z4h-complete-kubectl
Normal file
41
fn/-z4h-complete-kubectl
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
local kubectl="${commands[kubectl]-}"
|
||||
local orig_cmd="${_comps[kubectl]-}"
|
||||
local comp="$Z4H"/cache/kubectl-completion-$EUID.zsh
|
||||
local cmd
|
||||
|
||||
() {
|
||||
[[ -n "$kubectl" ]] || return
|
||||
|
||||
[[ "$comp" -nt "$kubectl" ]] || {
|
||||
local tmp="$comp".tmp."${sysparams[pid]}"
|
||||
"$kubectl" completion zsh >"$tmp" || return
|
||||
zf_mv -f -- "$tmp" "$comp" || return
|
||||
-z4h-compile "$comp" || return
|
||||
}
|
||||
|
||||
() {
|
||||
emulate -L zsh
|
||||
if (( ${+functions[_bash_comp]} )); then
|
||||
builtin source -- "$comp"
|
||||
else
|
||||
{
|
||||
function _bash_comp() {}
|
||||
builtin source -- "$comp"
|
||||
} always {
|
||||
unfunction _bash_comp
|
||||
}
|
||||
fi
|
||||
unset LWORD RWORD
|
||||
} || true
|
||||
|
||||
cmd="${_comps[kubectl]-}"
|
||||
[[ "$cmd" != "$orig_cmd" ]] || return
|
||||
} || {
|
||||
builtin unset '_comps[kubectl]'
|
||||
_default "$@"
|
||||
return
|
||||
}
|
||||
|
||||
builtin eval "$cmd"
|
Loading…
Add table
Add a link
Reference in a new issue