blob: 9a44f2d8eb685c4d77dabb653369c2ee89d57f47 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#autoload +X
local curcontext="${curcontext}" tmp err_fd=-1
local -a prefix
if [[ "$1" = -p ]]; then
shift
if (( $#_comp_priv_prefix )); then
curcontext="${curcontext%:*}/${${(@M)_comp_priv_prefix:#^*[^\\]=*}[1]}:"
zstyle -t ":completion:${curcontext}:${1}" gain-privileges &&
prefix=( $_comp_priv_prefix )
fi
fi
if (( ${debug_fd:--1} > 2 )) || [[ ! -t 2 ]]
then exec {err_fd}>&2 # debug_fd is saved stderr, 2 is trace or redirect
else exec {err_fd}>/dev/null
fi
{ # Begin "always" block
if zstyle -s ":completion:${curcontext}:${1}" command tmp; then
if [[ "$tmp" = -* ]]; then
eval "$tmp[2,-1]" "$argv[2,-1]"
else
eval $prefix "$tmp"
fi
else
eval $prefix "$argv[2,-1]"
fi 2>&$err_fd
} always {
exec {err_fd}>&-
}
|