@@ -2008,7 +2008,7 @@ _comp_compgen_inserted_kernel_modules()
20082008# context of current completion.
20092009#
20102010# @since 2.12
2011- _comp_compgen_usergroup ()
2011+ _comp_compgen_usergroups ()
20122012{
20132013 if [[ $cur == * \\\\ * || $cur == * :* :* ]]; then
20142014 # Give up early on if something seems horribly wrong.
@@ -2017,16 +2017,19 @@ _comp_compgen_usergroup()
20172017 # Completing group after 'user\:gr<TAB>'.
20182018 # Reply with a list of groups prefixed with 'user:', readline will
20192019 # escape to the colon.
2020- local _prefix
2021- _prefix=${cur%%* ([^:])}
2022- _prefix=${_prefix// \\ / }
2020+ local tmp
20232021 if [[ ${1-} == -u ]]; then
2024- _comp_compgen -c " ${cur#*: } " allowed_groups
2022+ _comp_compgen -v tmp - c " ${cur#*: } " allowed_groups
20252023 else
2026- _comp_compgen -c " ${cur#*: } " -- -g
2024+ _comp_compgen -v tmp -c " ${cur#*: } " -- -g
2025+ fi
2026+ if (( ${# tmp[@]} )) ; then
2027+ local _prefix=${cur%%* ([^:])}
2028+ _prefix=${_prefix// \\ / }
2029+ local -a _tmp=(" ${tmp[@]/#/ $_prefix } " )
2030+ _comp_unlocal tmp
2031+ _comp_compgen_set " ${_tmp[@]} "
20272032 fi
2028- (( ${# COMPREPLY[@]} )) &&
2029- COMPREPLY=(" ${COMPREPLY[@]/#/ $_prefix } " )
20302033 elif [[ $cur == * :* ]]; then
20312034 # Completing group after 'user:gr<TAB>'.
20322035 # Reply with a list of unprefixed groups since readline with split on :
@@ -2056,7 +2059,7 @@ _comp_compgen_allowed_users()
20562059 if _comp_as_root; then
20572060 _comp_compgen -- -u
20582061 else
2059- _comp_compgen split -- " $( id -un 2> /dev/null || whoami 2> /dev/null) "
2062+ _comp_compgen_split -- " $( id -un 2> /dev/null || whoami 2> /dev/null) "
20602063 fi
20612064}
20622065
@@ -2066,7 +2069,7 @@ _comp_compgen_allowed_groups()
20662069 if _comp_as_root; then
20672070 _comp_compgen -- -g
20682071 else
2069- _comp_compgen split -- " $( id -Gn 2> /dev/null || groups 2> /dev/null) "
2072+ _comp_compgen_split -- " $( id -Gn 2> /dev/null || groups 2> /dev/null) "
20702073 fi
20712074}
20722075
@@ -2110,7 +2113,7 @@ _comp_compgen_fstypes()
21102113 $( [[ -d /etc/fs ]] && command ls /etc/fs) "
21112114 fi
21122115
2113- [[ $_fss ]] && _comp_compgen -- -W " $_fss "
2116+ [[ $_fss ]] && _comp_compgen_split -- " $_fss "
21142117}
21152118
21162119# Get absolute path to a file, with rudimentary canonicalization.
@@ -2241,7 +2244,7 @@ _comp_compgen_dvd_devices()
22412244# @since 2.12
22422245_comp_compgen_terms ()
22432246{
2244- _comp_compgen -a split -- " $( {
2247+ _comp_compgen_split -- " $( {
22452248 command sed -ne ' s/^\([^[:space:]#|]\{2,\}\)|.*/\1/p' /etc/termcap
22462249 {
22472250 toe -a || toe
0 commit comments