| 1 |
_renice_module() |
| 2 |
{ |
| 3 |
local cur prev OPTS |
| 4 |
COMPREPLY=() |
| 5 |
cur="${COMP_WORDS[COMP_CWORD]}" |
| 6 |
prev="${COMP_WORDS[COMP_CWORD-1]}" |
| 7 |
case $prev in |
| 8 |
'-g'|'--pgrp') |
| 9 |
local PGRP |
| 10 |
PGRP=$(command ps -ax -opgrp | command sed '1d') |
| 11 |
COMPREPLY=( $(compgen -W "$PGRP" -- $cur) ) |
| 12 |
return 0 |
| 13 |
;; |
| 14 |
'-n'|'--priority') |
| 15 |
COMPREPLY=( $(compgen -W "{-20..20}" -- $cur) ) |
| 16 |
return 0 |
| 17 |
;; |
| 18 |
'-p'|'--pid') |
| 19 |
local PIDS |
| 20 |
PIDS=$(builtin cd /proc && echo [0-9]*) |
| 21 |
COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) |
| 22 |
return 0 |
| 23 |
;; |
| 24 |
'-u'|'--user') |
| 25 |
COMPREPLY=( $(compgen -u -- $cur) ) |
| 26 |
return 0 |
| 27 |
;; |
| 28 |
'-h'|'--help'|'-V'|'--version') |
| 29 |
return 0 |
| 30 |
;; |
| 31 |
esac |
| 32 |
OPTS="--pgrp |
| 33 |
--priority |
| 34 |
--pid |
| 35 |
--relative |
| 36 |
--user |
| 37 |
--help |
| 38 |
--version" |
| 39 |
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
| 40 |
return 0 |
| 41 |
} |
| 42 |
complete -F _renice_module renice |