2011-12-27 21:52:58 +02:00
|
|
|
# pgrep(1) and pkill(1) completion -*- shell-script -*-
|
2011-10-12 23:01:10 +03:00
|
|
|
|
|
|
|
_pgrep()
|
|
|
|
{
|
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
|
|
|
|
|
|
|
case $prev in
|
2011-12-27 21:52:58 +02:00
|
|
|
-c|-d|-g|-J|-M|-N|-s|-t|-T|-z)
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
-F)
|
|
|
|
_filedir
|
2011-10-12 23:01:10 +03:00
|
|
|
return
|
|
|
|
;;
|
|
|
|
-G)
|
|
|
|
_gids
|
|
|
|
return
|
|
|
|
;;
|
2011-12-27 21:52:58 +02:00
|
|
|
-j)
|
|
|
|
COMPREPLY=( $( compgen -W 'any none' -- "$cur" ) )
|
|
|
|
return
|
|
|
|
;;
|
2011-10-12 23:01:10 +03:00
|
|
|
-P)
|
|
|
|
_pids
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
-u|-U)
|
|
|
|
_uids
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [[ $cur == -* ]]; then
|
2011-12-27 21:52:58 +02:00
|
|
|
COMPREPLY=( $( compgen -W '$( "$1" --usage 2>&1 |
|
|
|
|
sed -e "s/\[-signal\]//" -e "s/\[-SIGNAL\]//" |
|
|
|
|
_parse_usage - )' -- "$cur" ) )
|
|
|
|
[[ $cword -eq 1 && $1 == *pkill ]] && _signals -
|
2011-10-12 23:01:10 +03:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2014-11-10 22:36:49 +02:00
|
|
|
_pnames -s
|
2011-10-12 23:01:10 +03:00
|
|
|
} &&
|
2011-12-27 21:52:58 +02:00
|
|
|
complete -F _pgrep pgrep pkill
|
2011-10-12 23:01:10 +03:00
|
|
|
|
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|