]> git.ipfire.org Git - thirdparty/util-linux.git/blob - bash-completion/lsipc
rev: be careful with close()
[thirdparty/util-linux.git] / bash-completion / lsipc
1 _lsipc_module()
2 {
3 local cur prev OPTS ARG
4 COMPREPLY=()
5 cur="${COMP_WORDS[COMP_CWORD]}"
6 prev="${COMP_WORDS[COMP_CWORD-1]}"
7 case $prev in
8 '-i'|'--id')
9 COMPREPLY=( $(compgen -W "id" -- $cur) )
10 return 0
11 ;;
12 '-h'|'--help'|'-V'|'--version')
13 return 0
14 ;;
15 '--time-format')
16 COMPREPLY=( $(compgen -W "short full iso" -- $cur) )
17 return 0
18 ;;
19 '-o'|'--output')
20 local prefix realcur OUTPUT_ALL OUTPUT
21 realcur="${cur##*,}"
22 prefix="${cur%$realcur}"
23 OUTPUT_ALL="
24 KEY ID OWNER PERMS CUID CUSER CGID
25 CGROUP UID USER GID GROUP CTIME
26
27 SIZE NATTCH STATUS ATTACH DETACH
28 COMMAND CPID LPID
29
30 USEDBYTES MSGS SEND RECV LSPID LRPID
31
32 NSEMS OTIME
33
34 RESOURCE DESCRIPTION LIMIT USED USE%
35 "
36 for WORD in $OUTPUT_ALL; do
37 if ! [[ $prefix == *"$WORD"* ]]; then
38 OUTPUT="$WORD ${OUTPUT:-""}"
39 fi
40 done
41 compopt -o nospace
42 COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
43 return 0
44 ;;
45 esac
46 OPTS="
47 --shmems
48 --queues
49 --semaphores
50 --global
51 --id
52 --noheadings
53 --notruncate
54 --time-format
55 --bytes
56 --creator
57 --export
58 --json
59 --newline
60 --list
61 --output
62 --numeric-perms
63 --raw
64 --time
65 --help
66 --version
67 "
68 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
69 return 0
70 }
71 complete -F _lsipc_module lsipc