]>
Commit | Line | Data |
---|---|---|
c6f8c3f5 SK |
1 | _prlimit_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 | '-p'|'--pid') | |
9 | PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done) | |
10 | COMPREPLY=( $(compgen -W "$PIDS" -- $cur) ) | |
11 | return 0 | |
12 | ;; | |
13 | '-o'|'--output') | |
b5b80e5a BE |
14 | local prefix realcur OUTPUT_ALL OUTPUT |
15 | realcur="${cur##*,}" | |
16 | prefix="${cur%$realcur}" | |
17 | OUTPUT_ALL="DESCRIPTION RESOURCE SOFT HARD UNITS" | |
18 | for WORD in $OUTPUT_ALL; do | |
19 | if ! [[ $prefix == *"$WORD"* ]]; then | |
20 | OUTPUT="$WORD $OUTPUT" | |
21 | fi | |
22 | done | |
c6f8c3f5 | 23 | compopt -o nospace |
b5b80e5a | 24 | COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) ) |
c6f8c3f5 SK |
25 | return 0 |
26 | ;; | |
d4f9b8d7 VS |
27 | '-h'|'--help'|'-V'|'--version') |
28 | return 0 | |
29 | ;; | |
c6f8c3f5 SK |
30 | esac |
31 | case $cur in | |
32 | '=') | |
33 | cur=${cur#=} | |
34 | # FIXME: is there anything what could be printed | |
35 | # as limit value(s) | |
36 | ;; | |
37 | -*) | |
0d5b9b8a VS |
38 | OPTS="--pid |
39 | --output | |
40 | --noheadings | |
41 | --raw | |
42 | --verbose | |
43 | --help | |
44 | --version | |
45 | --core= | |
46 | --data= | |
47 | --nice= | |
48 | --fsize= | |
49 | --sigpending= | |
50 | --memlock= | |
51 | --rss= | |
52 | --nofile= | |
53 | --msgqueue= | |
54 | --rtprio= | |
55 | --stack= | |
56 | --cpu= | |
57 | --nproc= | |
58 | --as= | |
59 | --locks= | |
60 | --rttime=" | |
c6f8c3f5 SK |
61 | COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
62 | return 0 | |
63 | ;; | |
64 | esac | |
65 | compopt -o bashdefault | |
66 | COMPREPLY=( $(compgen -c -- $cur) ) | |
67 | return 0 | |
68 | } | |
69 | complete -F _prlimit_module prlimit |