__fish_systemctl_*: use systemctl to generate the list of units

Closes #1804.

Note that if systemd is not running, the completion will fail.
This commit is contained in:
David Adam 2014-11-10 12:50:17 +08:00
parent f2447c537e
commit 00e0ed64bc
4 changed files with 12 additions and 8 deletions

View file

@ -1,4 +1,5 @@
function __fish_systemctl_mounts
command find /etc/systemd/system -type f -name '*.mount' -printf '%f\n'
command find /usr/lib/systemd/system -type f -name '*.mount' -printf '%f\n'
if type -q systemctl
systemctl list-unit-files --no-legend --type=mount ^/dev/null | cut -f 1 -d ' '
end
end

View file

@ -1,4 +1,5 @@
function __fish_systemctl_service_paths
command find /etc/systemd/system -type f -name '*.path' -printf '%f\n'
command find /usr/lib/systemd/system -type f -name '*.path' -printf '%f\n'
if type -q systemctl
systemctl list-unit-files --no-legend --type=path ^/dev/null | cut -f 1 -d ' '
end
end

View file

@ -1,4 +1,5 @@
function __fish_systemctl_services
command find /etc/systemd/system -type f -name '*.service' -printf '%f\n'
command find /usr/lib/systemd/system -type f -name '*.service' -printf '%f\n'
if type -q systemctl
systemctl list-unit-files --no-legend --type=service ^/dev/null | cut -f 1 -d ' '
end
end

View file

@ -1,4 +1,5 @@
function __fish_systemctl_sockets
command find /etc/systemd/system -type f -name '*.socket' -printf '%f\n'
command find /usr/lib/systemd/system -type f -name '*.socket' -printf '%f\n'
if type -q systemctl
systemctl list-unit-files --no-legend --type=socket ^/dev/null | cut -f 1 -d ' '
end
end