5 cur="${COMP_WORDS[COMP_CWORD]}"
6 prev="${COMP_WORDS[COMP_CWORD-1]}"
8 '--ambient-caps'|'--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 $1}')
25 COMPREPLY=( $(compgen -W "$UIDS" -- $cur) )
28 '--rgid'|'--egid'|'--regid')
30 GIDS=$(getent group | awk -F: '{print $1}')
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
41 GIDS="$WORD ${GIDS:-""}"
45 COMPREPLY=( $(compgen -P "$prefix" -W "$GIDS" -S ',' -- $realcur) )
49 local prefix realcur SBITS_ALL SBITS WORD
51 prefix="${cur%$realcur}"
57 {+,-}no_setuid_fixup_locked
59 for WORD in $SBITS_ALL; do
60 if ! [[ $prefix == *"$WORD"* ]]; then
61 SBITS="$WORD ${SBITS:-""}"
65 COMPREPLY=( $(compgen -P "$prefix" -W "$SBITS" -S ',' -- $realcur) )
70 for i in $(kill -l); do
77 COMPREPLY=( $(compgen -W "keep clear $signals" -- $cur) )
81 # FIXME: how to list selinux labels?
82 COMPREPLY=( $(compgen -W "label" -- $cur) )
86 # FIXME: how to list apparmor profiles?
87 COMPREPLY=( $(compgen -W "profile" -- $cur) )
91 # FIXME: how to list landlock accesses?
92 COMPREPLY=( $(compgen -W "access" -- $cur) )
96 # FIXME: how to list landlock rules?
97 COMPREPLY=( $(compgen -W "rule" -- $cur) )
100 '-h'|'--help'|'-V'|'--version')
129 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
133 compopt -o bashdefault
134 COMPREPLY=( $(compgen -c -- $cur) )
137 complete -F _setpriv_module setpriv