1
0

zsh: update

This commit is contained in:
2024-02-18 02:32:08 +03:00
parent aea9334649
commit 9725317a4a
8 changed files with 100 additions and 23 deletions

View File

@@ -1,9 +1,28 @@
#!/bin/zsh
__z_comp__kubectl() { command kubectl completion zsh ; }
__z_comp__podman() { command podman completion zsh ; }
typeset -A ZSHU_COMP_EXTERNAL
for i ( kubectl podman ) ; do
__z_comp_external $i "__z_comp__$i"
for i ( kubectl podman skopeo docker ) ; do
ZSHU_COMP_EXTERNAL[$i]="command $i completion zsh"
done ; unset i
unset -fm '__z_comp__*'
# ZSHU_COMP_EXTERNAL[yq]='command yq shell-completion zsh'
## example of "automatic" shell completion generation
__z_comp_ext__yq() { command yq shell-completion zsh ; }
## example of more complex shell completion generation
# __z_comp__shifty_nifty() { command shifty-nifty completion zsh | sed -E 's/shifty_nifty/shifty-nifty/g' ; }
# ZSHU_COMP_EXTERNAL[shifty-nifty]='__z_comp__shifty_nifty'
z-comp-auto() {
local c f
for c ( ${(k)ZSHU_COMP_EXTERNAL} ) ; do
__z_comp_external "$c" "${(@s: :)ZSHU_COMP_EXTERNAL[$c]}" && unset "ZSHU_COMP_EXTERNAL[$c]"
done
for f ( ${functions[(I)__z_comp_ext__*]} ) ; do
c=${f#__z_comp_ext__}
__z_comp_external $c $f && unset -f "$f"
done
}
z-comp-auto