]> git.ipfire.org Git - thirdparty/util-linux.git/blame - bash-completion/ipcrm
bash-completion: rename shell-completion -> bash-completion
[thirdparty/util-linux.git] / bash-completion / ipcrm
CommitLineData
c6f8c3f5
SK
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 esac
39 case $cur in
40 '=')
41 cur=${cur#=}
42 COMPREPLY=( $(compgen -W "shm msg sem" -- $cur) )
43 return 0
44 ;;
45 esac
46 OPTS=" -m --shmem-id
47 -M --shmem-key
48 -q --queue-id
49 -Q --queue-key
50 -s --semaphore-id
51 -S --semaphore-key
52 -a= --all=
53 -v --verbose
54 -h --help
55 -V --version"
56 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
57 return 0
58}
59complete -F _ipcrm_module ipcrm