zsh: update
This commit is contained in:
parent
f77e4a54bc
commit
b9b056d10d
@ -5,24 +5,13 @@ typeset -A ZSHU_COMP_EXTERNAL
|
||||
for i ( kubectl podman skopeo docker ) ; do
|
||||
ZSHU_COMP_EXTERNAL[$i]="command $i completion zsh"
|
||||
done ; unset i
|
||||
# ZSHU_COMP_EXTERNAL[yq]='command yq shell-completion zsh'
|
||||
|
||||
## example of "automatic" shell completion generation
|
||||
# ZSHU_COMP_EXTERNAL[yq]='command yq shell-completion zsh'
|
||||
__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
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/zsh
|
||||
|
||||
typeset -gA ZSHU_COMP_FORCE
|
||||
|
||||
ZSHU[f_compdump]="${ZSHU[d_cache]}/compdump"
|
||||
ZSHU[d_compcache]="${ZSHU[d_cache]}/compcache"
|
||||
[ -d "${ZSHU[d_compcache]}" ] || mkdir -p "${ZSHU[d_compcache]}"
|
||||
@ -111,3 +113,21 @@ z-comp-invalidate() {
|
||||
[ -f "$f" ] || return 2
|
||||
rm -f "$f" || return 3
|
||||
}
|
||||
|
||||
## reload or new session are required to regenerate completions
|
||||
z-comp-flush() {
|
||||
find "${ZSHU[d_cache]}/completion/" -xdev -type f '!' -name '.keep' -delete
|
||||
}
|
||||
|
||||
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
|
||||
}
|
@ -1,4 +1,10 @@
|
||||
#!/bin/zsh
|
||||
|
||||
typeset -gA ZSHU_COMP_FORCE
|
||||
## skip system-wide podman completion and produce own
|
||||
ZSHU_COMP_FORCE[podman]=1
|
||||
|
||||
## systemctl status podman.socket
|
||||
export DOCKER_HOST=/run/podman/podman.sock
|
||||
|
||||
## systemctl --user status podman.socket
|
||||
export DOCKER_HOST=${XDG_RUNTIME_DIR}/podman/podman.sock
|
||||
|
Loading…
Reference in New Issue
Block a user