1
0

modify external completion routines

This commit is contained in:
Konstantin Demin 2021-03-22 22:57:36 +03:00
parent 26f29d0514
commit 7bf6262945
Signed by: krd
GPG Key ID: 1F33CB0BA4731BC6
4 changed files with 12 additions and 11 deletions

View File

@ -1,6 +1,7 @@
* *
!/.cache/zsh/.keep !/.cache/zsh/.keep
!/.cache/zsh/compcache/.keep !/.cache/zsh/compcache/.keep
!/.cache/zsh/completion/.keep
!/.config/dotfiles/bin/.keep !/.config/dotfiles/bin/.keep
!/.config/dotfiles/gen-gitignore.sh !/.config/dotfiles/gen-gitignore.sh
!/.config/dotfiles/gitignore !/.config/dotfiles/gitignore
@ -38,7 +39,6 @@
!/.config/zsh/lib/starship.zsh.sample !/.config/zsh/lib/starship.zsh.sample
!/.config/zsh/lib/time.zsh !/.config/zsh/lib/time.zsh
!/.config/zsh/local/.keep !/.config/zsh/local/.keep
!/.config/zsh/local/completion/.keep
!/.config/zsh/opt.zsh !/.config/zsh/opt.zsh
!/.config/zsh/opt/chase.zsh !/.config/zsh/opt/chase.zsh
!/.config/zsh/opt/completion.zsh !/.config/zsh/opt/completion.zsh

View File

@ -1,3 +1,5 @@
#!/bin/zsh #!/bin/zsh
__z_comp_test podman && podman completion zsh | __z_comp_write podman __z_comp_podman() { command podman completion zsh ; }
__z_comp_external podman __z_comp_podman
unset -f __z_comp_podman

View File

@ -4,7 +4,7 @@ ZSHU[f_compdump]="${ZSHU[d_cache]}/compdump"
ZSHU[d_compcache]="${ZSHU[d_cache]}/compcache" ZSHU[d_compcache]="${ZSHU[d_cache]}/compcache"
[ -d "${ZSHU[d_compcache]}" ] || mkdir -p "${ZSHU[d_compcache]}" [ -d "${ZSHU[d_compcache]}" ] || mkdir -p "${ZSHU[d_compcache]}"
fpath=( "${ZSHU[d_compcache]}" $fpath ) fpath=( "${ZSHU[d_cache]}/completion" $fpath )
__z_compdump_print() { printf '#zshu %s %s\n' "$1" "${(P)1}" ; } __z_compdump_print() { printf '#zshu %s %s\n' "$1" "${(P)1}" ; }
@ -56,14 +56,13 @@ __z_comp_bash() {
return 0 return 0
} }
__z_comp_test() { __z_comp_external() {
(( ${+commands[$1]} )) || return 1 (( ${+commands[$1]} )) || return 1
(( ${+_comps[$1]} )) && return 2 (( ${+_comps[$1]} )) && return 2
[ -s "${ZSHU[d_compcache]}/_$1" ] && return 3 local f="${ZSHU[d_cache]}/completion/_$1"
return 0 if ! [ -s "$f" ] ; then
} "$2" > "$f" || return 3
fi
__z_comp_write() { autoload -Uz "_$1"
cat > "${ZSHU[d_compcache]}/_$1"
return 0 return 0
} }