2019-01-12 15:47:23 +00:00
|
|
|
#compdef n-kill
|
|
|
|
|
|
|
|
local context ret=1
|
|
|
|
|
|
|
|
typeset -a list linewords
|
|
|
|
typeset -aU words wordbits
|
|
|
|
local line word
|
|
|
|
integer cygwin=0
|
|
|
|
|
|
|
|
local IFS="
|
|
|
|
"
|
|
|
|
|
2020-06-11 14:59:30 +00:00
|
|
|
case "$OSTYPE" in
|
|
|
|
cygwin*) list=( `command ps -Wa` ); cygwin=1 ;;
|
2019-01-12 15:47:23 +00:00
|
|
|
*) list=( `command ps -o pid,uid,command -A` ) ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
shift list
|
|
|
|
|
|
|
|
IFS=" "
|
|
|
|
for line in "${list[@]}"; do
|
|
|
|
linewords=( $=line )
|
|
|
|
if [ "$cygwin" = "1" ]; then
|
|
|
|
linewords=( "${(@)linewords[8,-1]}" )
|
|
|
|
else
|
|
|
|
linewords=( "${(@)linewords[3,-1]}" )
|
|
|
|
fi
|
|
|
|
for word in "${linewords[@]}"; do
|
|
|
|
if [ "$cygwin" = "1" ]; then
|
|
|
|
wordbits=( "${(@s:\:)word}" )
|
|
|
|
else
|
|
|
|
wordbits=( "${(@s:/:)word}" )
|
|
|
|
fi
|
|
|
|
words+=( "${wordbits[@]}" )
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
_wanted bits expl "Processes' name bits" \
|
2020-06-11 14:59:30 +00:00
|
|
|
compadd "$@" -a - words && ret=0
|
2019-01-12 15:47:23 +00:00
|
|
|
|
|
|
|
return "$ret"
|