]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/prlimit
rev: be careful with close()
[thirdparty/util-linux.git] / bash-completion / prlimit
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=$(cd /proc && echo [0-9]*)
10 COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
11 return 0
12 ;;
13 '-o'|'--output')
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
23 compopt -o nospace
24 COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
25 return 0
26 ;;
27 '-h'|'--help'|'-V'|'--version')
28 return 0
29 ;;
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 -*)
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="
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