diff options
author | Sami Kerola | 2018-04-05 21:56:55 +0200 |
---|---|---|
committer | Karel Zak | 2018-04-06 13:03:38 +0200 |
commit | ecfb5b267c46f4425abcdbec203447fa5e147bf2 (patch) | |
tree | 499dcf3c00404ae687b8ae2f738207664b826ef1 /bash-completion | |
parent | bash-completion: do not print eject --cdspeed error messages (diff) | |
download | kernel-qcow2-util-linux-ecfb5b267c46f4425abcdbec203447fa5e147bf2.tar.gz kernel-qcow2-util-linux-ecfb5b267c46f4425abcdbec203447fa5e147bf2.tar.xz kernel-qcow2-util-linux-ecfb5b267c46f4425abcdbec203447fa5e147bf2.zip |
bash-completion: setpriv --securebits argument can be comma separated list
Make the option argument suggestion to match with what is allowed. In same
go tidy shell code a little bit.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'bash-completion')
-rw-r--r-- | bash-completion/setpriv | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/bash-completion/setpriv b/bash-completion/setpriv index bf4737a3a..1c67f8288 100644 --- a/bash-completion/setpriv +++ b/bash-completion/setpriv @@ -46,10 +46,23 @@ _setpriv_module() return 0 ;; '--securebits') - local SBITS - SBITS="noroot noroot_locked no_setuid_fixup no_setuid_fixup_locked keep_caps_locked - -noroot -noroot_locked -no_setuid_fixup -no_setuid_fixup_locked -keep_caps_locked" - COMPREPLY=( $(compgen -W "$SBITS" -- $cur) ) + local prefix realcur SBITS_ALL SBITS WORD + realcur="${cur##*,}" + prefix="${cur%$realcur}" + SBITS_ALL=" + {+,-}keep_caps_locked + {+,-}noroot + {+,-}noroot_locked + {+,-}no_setuid_fixup + {+,-}no_setuid_fixup_locked + " + for WORD in $SBITS_ALL; do + if ! [[ $prefix == *"$WORD"* ]]; then + SBITS="$WORD ${SBITS:-""}" + fi + done + compopt -o nospace + COMPREPLY=( $(compgen -P "$prefix" -W "$SBITS" -S ',' -- $realcur) ) return 0 ;; '--selinux-label') |