bash-completions/rc-service: don't use grep
Co-authored-by: Mike Frysinger <vapier@gentoo.org> Closes: https://github.com/OpenRC/openrc/issues/344
This commit is contained in:
parent
ae5e38dce5
commit
36cc40a9d6
@ -85,9 +85,9 @@ _rc_service()
|
|||||||
else
|
else
|
||||||
# no option was typed
|
# no option was typed
|
||||||
if [[ ${COMP_CWORD} -eq 1 ]]; then # if first word typed
|
if [[ ${COMP_CWORD} -eq 1 ]]; then # if first word typed
|
||||||
words="$(rc-service --list | grep ^${cur})" # complete for init scripts
|
# complete for init scripts
|
||||||
COMPREPLY=($(for i in ${words} ; do \
|
COMPREPLY=($(for i in $(rc-service --list) ; do \
|
||||||
[[ ${i} == ${cur}* ]] && echo ${i} ; \
|
[[ ${i} == "${cur}"* ]] && echo ${i} ; \
|
||||||
done))
|
done))
|
||||||
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
|
||||||
@ -105,9 +105,8 @@ _rc_service()
|
|||||||
fi
|
fi
|
||||||
if [[ ${action} == '--exists' ]] || [[ ${action} == '-e' ]] || \
|
if [[ ${action} == '--exists' ]] || [[ ${action} == '-e' ]] || \
|
||||||
[[ ${action} == '--resolve' ]] || [[ ${action} == '-r' ]]; then
|
[[ ${action} == '--resolve' ]] || [[ ${action} == '-r' ]]; then
|
||||||
words="$(rc-service --list | grep ^${cur})"
|
COMPREPLY=($(for i in $(rc-service --list) ; do \
|
||||||
COMPREPLY=($(for i in ${words} ; do \
|
[[ ${i} == "${cur}"* ]] && echo ${i} ; \
|
||||||
[[ ${i} == ${cur}* ]] && echo ${i} ; \
|
|
||||||
done))
|
done))
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user