]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/ionice
fstrim shouldn't run inside a container
[thirdparty/util-linux.git] / bash-completion / ionice
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')
9 COMPREPLY=( $(compgen -W "{0..3} none realtime best-effort idle" -- $cur) )
10 return 0
11 ;;
12 '-n'|'--classdata')
13 COMPREPLY=( $(compgen -W "{0..7}" -- $cur) )
14 return 0
15 ;;
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 ;;
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 ;;
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 ;;
34 '-h'|'--help'|'-V'|'--version')
35 return 0
36 ;;
37 esac
38 case $cur in
39 -*)
40 OPTS="--class --classdata --pid --pgid --ignore --uid --version --help"
41 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
42 return 0
43 ;;
44 esac
45 local IFS=$'\n'
46 compopt -o filenames
47 COMPREPLY=( $(compgen -f -- $cur) )
48 return 0
49 }
50 complete -F _ionice_module ionice