mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 04:43:10 +00:00
Improve __fish_print_service_names
- Reuse systemd completion functions - Remove a fork - Fix #2715 - FreeBSD - Comments
This commit is contained in:
parent
c4d0612e5c
commit
57fcbecb41
1 changed files with 9 additions and 5 deletions
|
@ -1,9 +1,13 @@
|
||||||
function __fish_print_service_names -d 'All services known to the system'
|
function __fish_print_service_names -d 'All services known to the system'
|
||||||
if test -d /run/systemd/system
|
if test -d /run/systemd/system # Systemd systems
|
||||||
command systemctl list-units -t service | cut -d ' ' -f 1 | grep '\.service$' | sed -e 's/\.service$//'
|
# For the `service` command, this needs to be without the type suffix
|
||||||
else if type -f rc-service 2> /dev/null
|
# 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
|
command rc-service -l
|
||||||
else
|
else if test -d /etc/init.d # SysV on Debian and other linuxen
|
||||||
command ls /etc/init.d
|
string replace '/etc/init.d/' '' -- /etc/init.d/*
|
||||||
|
else # Freebsd
|
||||||
|
command service -l
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue