bash-completion/rc-service: don't set or unset extglob

It breaks bash-completion.
It's not necessary to set extglob as patterns in '[[' after '=='
are always matched as if extglob were set.

Closes: #636
Signed-off-by: Jernej Jakob <jernej.jakob@gmail.com>
This commit is contained in:
Jernej Jakob 2023-07-06 02:25:53 +02:00 committed by Doug Freed
parent 92662ddc44
commit cd53239701

View File

@ -92,13 +92,11 @@ _rc_service()
return 0 return 0
elif [[ ${COMP_CWORD} -eq 2 ]] && [[ ${prev} != -* ]]; then # if second word typed and we didn't type in a function elif [[ ${COMP_CWORD} -eq 2 ]] && [[ ${prev} != -* ]]; then # if second word typed and we didn't type in a function
rc-service --exists "$prev" || return rc-service --exists "$prev" || return
shopt -s extglob
while read -r _ line; do while read -r _ line; do
if [[ $line == +([[:alnum:]_]):* ]]; then if [[ $line == +([[:alnum:]_]):* ]]; then
opts+="${line%%:*} " opts+="${line%%:*} "
fi fi
done < <(rc-service "$prev" describe 2>&1) done < <(rc-service "$prev" describe 2>&1)
shopt -u extglob
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0 return 0
fi fi