| 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="$(command lsipc -m --noheadings -o ID)" |
| 10 |
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) |
| 11 |
return 0 |
| 12 |
;; |
| 13 |
'-M'|'--shmem-key') |
| 14 |
KEYIDS="$(command lsipc -m --noheadings -o KEY)" |
| 15 |
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) |
| 16 |
return 0 |
| 17 |
;; |
| 18 |
'--posix-shmem') |
| 19 |
KEYIDS="$(command lsipc -M --noheadings -o NAME)" |
| 20 |
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) |
| 21 |
return 0 |
| 22 |
;; |
| 23 |
'-q'|'--queue-id') |
| 24 |
KEYIDS="$(command lsipc -q --noheadings -o ID)" |
| 25 |
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) |
| 26 |
return 0 |
| 27 |
;; |
| 28 |
'-Q'|'--queue-key') |
| 29 |
KEYIDS="$(command lsipc -q --noheadings -o KEY)" |
| 30 |
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) |
| 31 |
return 0 |
| 32 |
;; |
| 33 |
'--posix-mqueue') |
| 34 |
KEYIDS="$(command lsipc -Q --noheadings -o NAME)" |
| 35 |
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) |
| 36 |
return 0 |
| 37 |
;; |
| 38 |
'-s'|'--semaphore-id') |
| 39 |
KEYIDS="$(command lsipc -s --noheadings -o ID)" |
| 40 |
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) |
| 41 |
return 0 |
| 42 |
;; |
| 43 |
'-S'|'--semaphore-key') |
| 44 |
KEYIDS="$(command lsipc -s --noheadings -o KEY)" |
| 45 |
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) |
| 46 |
return 0 |
| 47 |
;; |
| 48 |
'--posix-semaphore') |
| 49 |
KEYIDS="$(command lsipc -S --noheadings -o NAME)" |
| 50 |
COMPREPLY=( $(compgen -W "$KEYIDS" -- $cur) ) |
| 51 |
return 0 |
| 52 |
;; |
| 53 |
'-h'|'--help'|'-V'|'--version') |
| 54 |
return 0 |
| 55 |
;; |
| 56 |
esac |
| 57 |
case $cur in |
| 58 |
'=') |
| 59 |
cur=${cur#=} |
| 60 |
COMPREPLY=( $(compgen -W "shm pshm msg pmsg sem psem" -- $cur) ) |
| 61 |
return 0 |
| 62 |
;; |
| 63 |
esac |
| 64 |
OPTS=" --shmem-id |
| 65 |
--shmem-key |
| 66 |
--posix-shmem |
| 67 |
--queue-id |
| 68 |
--queue-key |
| 69 |
--posix-mqueue |
| 70 |
--semaphore-id |
| 71 |
--semaphore-key |
| 72 |
--posix-semaphore |
| 73 |
--all= |
| 74 |
--verbose |
| 75 |
--help |
| 76 |
--version" |
| 77 |
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
| 78 |
return 0 |
| 79 |
} |
| 80 |
complete -F _ipcrm_module ipcrm |