about summary refs log tree commit diff
path: root/Completion/Base/Utility/_call_program
blob: b65764827cb2ffc8b7a88c452efb9e47c0ae163d (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
#autoload +X

local tmp err_fd=-1

if (( ${debug_fd:--1} > 2 ))
then exec {err_fd}>&2	# debug_fd is saved stderr, 2 is log file
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}>&-

}