]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/ipcrm
rev: be careful with close()
[thirdparty/util-linux.git] / bash-completion / ipcrm
1 _ipcrm_module()
2 {
3 local cur prev OPTS KEYIDS
4 COMPREPLY=()
5 cur="${COMP_WORDS[COMP_CWORD]}"
6 prev="${COMP_WORDS[COMP_CWORD-1]}"
7 case $prev in
8 '-m'|'--shmem-id')
9 KEYIDS="$(ipcs -m | awk '{if (3 < NR) {print $2}}')"
10 COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
11 return 0
12 ;;
13 '-M'|'--shmem-key')
14 KEYIDS="$(ipcs -m | awk '{if (3 < NR) {print $1}}')"
15 COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
16 return 0
17 ;;
18 '-q'|'--queue-id')
19 KEYIDS="$(ipcs -q | awk '{if (3 < NR) {print $2}}')"
20 COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
21 return 0
22 ;;
23 '-Q'|'--queue-key')
24 KEYIDS="$(ipcs -q | awk '{if (3 < NR) {print $1}}')"
25 COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
26 return 0
27 ;;
28 '-s'|'--semaphore-id')
29 KEYIDS="$(ipcs -s | awk '{if (3 < NR) {print $2}}')"
30 COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
31 return 0
32 ;;
33 '-S'|'--semaphore-key')
34 KEYIDS="$(ipcs -s | awk '{if (3 < NR) {print $1}}')"
35 COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) )
36 return 0
37 ;;
38 '-h'|'--help'|'-V'|'--version')
39 return 0
40 ;;
41 esac
42 case $cur in
43 '=')
44 cur=${cur#=}
45 COMPREPLY=( $(compgen -W "shm msg sem" -- $cur) )
46 return 0
47 ;;
48 esac
49 OPTS=" --shmem-id
50 --shmem-key
51 --queue-id
52 --queue-key
53 --semaphore-id
54 --semaphore-key
55 --all=
56 --verbose
57 --help
58 --version"
59 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
60 return 0
61 }
62 complete -F _ipcrm_module ipcrm