completions/service: Fix output on OpenRC systems

This used `type -f`, which prints, and only silenced stderr.

Detected by running the check-completions test on Alpine.

It appears nobody does that.
This commit is contained in:
Fabian Boehm 2022-07-24 09:51:15 +02:00
parent e4c7211cd6
commit e6f4c9e162

View file

@ -4,7 +4,7 @@ complete -c service -n "__fish_is_nth_token 1" -xa "(__fish_print_service_names)
# as found in __fish_print_service_names.fish
if test -d /run/systemd/system # Systemd systems
complete -c service -n 'not __fish_is_nth_token 1' -xa "start stop restart status enable disable"
else if type -f rc-service 2>/dev/null # OpenRC (Gentoo)
else if command -sq rc-service # OpenRC (Gentoo)
complete -c service -n 'not __fish_is_nth_token 1' -xa "start stop restart"
else if test -d /etc/init.d # SysV on Debian and other linuxen
complete -c service -n 'not __fish_is_nth_token 1' -xa "start stop --full-restart"