| 1 |
_chrt_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 |
'-h'|'--help'|'-V'|'--version') |
| 9 |
return 0 |
| 10 |
;; |
| 11 |
'-T'|'--sched-runtime'|'-P'|'--sched-period'|'-D'|'--sched-deadline') |
| 12 |
COMPREPLY=( $(compgen -W "nanoseconds" -- $cur) ) |
| 13 |
return 0 |
| 14 |
;; |
| 15 |
esac |
| 16 |
case $cur in |
| 17 |
-*) |
| 18 |
OPTS=" |
| 19 |
--all-tasks |
| 20 |
--batch |
| 21 |
--deadline |
| 22 |
--ext |
| 23 |
--fifo |
| 24 |
--help |
| 25 |
--idle |
| 26 |
--max |
| 27 |
--other |
| 28 |
--pid |
| 29 |
--reset-on-fork |
| 30 |
--rr |
| 31 |
--sched-deadline |
| 32 |
--sched-period |
| 33 |
--sched-runtime |
| 34 |
--verbose |
| 35 |
--version |
| 36 |
" |
| 37 |
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
| 38 |
return 0 |
| 39 |
;; |
| 40 |
esac |
| 41 |
local i |
| 42 |
for i in ${COMP_WORDS[*]}; do |
| 43 |
case $i in |
| 44 |
'-p'|'--pid') |
| 45 |
COMPREPLY=( $(compgen -W "$(builtin cd /proc && echo [0-9]*)" -- $cur) ) |
| 46 |
return 0 |
| 47 |
;; |
| 48 |
esac |
| 49 |
done |
| 50 |
COMPREPLY=( $(compgen -c -- $cur) ) |
| 51 |
return 0 |
| 52 |
} |
| 53 |
complete -F _chrt_module chrt |