]>
Commit | Line | Data |
---|---|---|
18b0017a SK |
1 | _ionice_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 | '-c'|'--class') | |
d6b975ef | 9 | COMPREPLY=( $(compgen -W "{0..3} none realtime best-effort idle" -- $cur) ) |
18b0017a SK |
10 | return 0 |
11 | ;; | |
12 | '-n'|'--classdata') | |
d6b975ef | 13 | COMPREPLY=( $(compgen -W "{0..7}" -- $cur) ) |
18b0017a SK |
14 | return 0 |
15 | ;; | |
f2b98132 SK |
16 | '-P'|'--pgid') |
17 | local PGID | |
18 | PGID="$(awk '{print $5}' /proc/*/stat 2>/dev/null | sort -u)" | |
19 | COMPREPLY=( $(compgen -W "$PGID" -- $cur) ) | |
20 | return 0 | |
21 | ;; | |
18b0017a SK |
22 | '-p'|'--pid') |
23 | local PIDS | |
24 | PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done) | |
25 | COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) | |
26 | return 0 | |
27 | ;; | |
f2b98132 SK |
28 | '-u'|'--uid') |
29 | local UIDS | |
30 | UIDS="$(stat --format='%u' /proc/[0-9]* | sort -u)" | |
31 | COMPREPLY=( $(compgen -W "$UIDS" -- $cur) ) | |
32 | return 0 | |
33 | ;; | |
d4f9b8d7 VS |
34 | '-h'|'--help'|'-V'|'--version') |
35 | return 0 | |
36 | ;; | |
18b0017a SK |
37 | esac |
38 | case $cur in | |
39 | -*) | |
f2b98132 | 40 | OPTS="--class --classdata --pid --pgid --ignore --uid --version --help" |
18b0017a SK |
41 | COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
42 | return 0 | |
43 | ;; | |
44 | esac | |
ce3e6b15 | 45 | local IFS=$'\n' |
18b0017a SK |
46 | compopt -o filenames |
47 | COMPREPLY=( $(compgen -f -- $cur) ) | |
48 | return 0 | |
49 | } | |
50 | complete -F _ionice_module ionice |