1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-23 00:41:03 +01:00
zsh/Completion/Base/Utility/_call_program

26 lines
442 B
Text

#autoload +X
local tmp err_fd=-1
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 "$tmp"
fi
else
eval "$argv[2,-1]"
fi 2>&$err_fd
} always {
exec {err_fd}>&-
}