5 cur="${COMP_WORDS[COMP_CWORD]}"
6 prev="${COMP_WORDS[COMP_CWORD-1]}"
8 '--inh-caps'|'--bounding-set')
9 local prefix realcur INHERIT_ALL INHERIT
11 prefix="${cur%$realcur}"
12 INHERIT_ALL=$($1 --list-caps| awk '{print $1, "-" $1}')
13 for WORD in $INHERIT_ALL; do
14 if ! [[ $prefix == *"$WORD"* ]]; then
15 INHERIT="$WORD $INHERIT"
19 COMPREPLY=( $(compgen -P "$prefix" -W "$INHERIT" -S ',' -- $realcur) )
22 '--ruid'|'--euid'|'--reuid')
24 UIDS=$(getent passwd | awk -F: '{print $3}')
25 COMPREPLY=( $(compgen -W "$UIDS" -- $cur) )
28 '--rgid'|'--egid'|'--regid')
30 GIDS=$(getent group | awk -F: '{print $3}')
31 COMPREPLY=( $(compgen -W "$GIDS" -- $cur) )
35 local prefix realcur GIDS_ALL GIDS
37 prefix="${cur%$realcur}"
38 GIDS_ALL=$(getent group | awk -F: '{print $3}')
39 for WORD in $GIDS_ALL; do
40 if ! [[ $prefix == *"$WORD"* ]]; then
45 COMPREPLY=( $(compgen -P "$prefix" -W "$GIDS" -S ',' -- $realcur) )
50 SBITS="noroot noroot_locked no_setuid_fixup no_setuid_fixup_locked keep_caps_locked
51 -noroot -noroot_locked -no_setuid_fixup -no_setuid_fixup_locked -keep_caps_locked"
52 COMPREPLY=( $(compgen -W "$SBITS" -- $cur) )
56 # FIXME: how to list selinux labels?
57 COMPREPLY=( $(compgen -W "label" -- $cur) )
61 # FIXME: how to list apparmor profiles?
62 COMPREPLY=( $(compgen -W "profile" -- $cur) )
65 '-h'|'--help'|'-V'|'--version')
89 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
93 compopt -o bashdefault
94 COMPREPLY=( $(compgen -c -- $cur) )
97 complete -F _setpriv_module setpriv