about summary refs log tree commit diff
path: root/Completion/Builtins/_kill
blob: b79bfd6c0295485e69f114cea67515a28db17cb4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#compdef kill

local list expl

if compset -P 1 -; then
  _description expl signal
  compadd "$expl[@]" $signals[1,-3]
else
  local ret=1

  _job && ret=0

  list=("${(@M)${(f@)$(ps ${=compconfig[ps_listargs]:-$=compconfig[ps_args]} 2>/dev/null)}[2,-1]:#[ 	]#${PREFIX}[0-9]#${SUFFIX}[ 	]*}")
  _description expl 'process ID'
  compadd "$expl[@]" -ld list - ${${${(f)"$(ps $=compconfig[ps_args] 2>/dev/null)"}[2,-1]## #}%% *} &&
    ret=0

  return ret
fi