fish-shell/share/functions/__fish_print_service_names.fish
Fabian Homborg 57fcbecb41 Improve __fish_print_service_names
- Reuse systemd completion functions
- Remove a fork
- Fix #2715 - FreeBSD
- Comments
2016-02-07 14:53:12 +01:00

13 lines
543 B
Fish

function __fish_print_service_names -d 'All services known to the system'
if test -d /run/systemd/system # Systemd systems
# For the `service` command, this needs to be without the type suffix
# on Debian at least
__fish_systemctl_services | string replace -r '.service$' ''
else if type -f rc-service ^/dev/null # OpenRC (Gentoo)
command rc-service -l
else if test -d /etc/init.d # SysV on Debian and other linuxen
string replace '/etc/init.d/' '' -- /etc/init.d/*
else # Freebsd
command service -l
end
end