diff options
author | 2014-11-10 12:50:17 +0800 | |
---|---|---|
committer | 2014-11-10 12:51:07 +0800 | |
commit | 00e0ed64bc2e4b918357b10fbd176797eeb07402 (patch) | |
tree | b0109c93e36319476d83618a661c59c98c8a1679 /share | |
parent | f2447c537ef3c944da87e00e13f816d3a6c7548f (diff) |
__fish_systemctl_*: use systemctl to generate the list of units
Closes #1804.
Note that if systemd is not running, the completion will fail.
Diffstat (limited to 'share')
-rw-r--r-- | share/functions/__fish_systemctl_mounts.fish | 5 | ||||
-rw-r--r-- | share/functions/__fish_systemctl_service_paths.fish | 5 | ||||
-rw-r--r-- | share/functions/__fish_systemctl_services.fish | 5 | ||||
-rw-r--r-- | share/functions/__fish_systemctl_sockets.fish | 5 |
4 files changed, 12 insertions, 8 deletions
diff --git a/share/functions/__fish_systemctl_mounts.fish b/share/functions/__fish_systemctl_mounts.fish index 706e6ee8..5f23bba1 100644 --- a/share/functions/__fish_systemctl_mounts.fish +++ b/share/functions/__fish_systemctl_mounts.fish @@ -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 diff --git a/share/functions/__fish_systemctl_service_paths.fish b/share/functions/__fish_systemctl_service_paths.fish index 6f8435cf..2f79ec10 100644 --- a/share/functions/__fish_systemctl_service_paths.fish +++ b/share/functions/__fish_systemctl_service_paths.fish @@ -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 diff --git a/share/functions/__fish_systemctl_services.fish b/share/functions/__fish_systemctl_services.fish index a9fd38ba..f48cb324 100644 --- a/share/functions/__fish_systemctl_services.fish +++ b/share/functions/__fish_systemctl_services.fish @@ -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 diff --git a/share/functions/__fish_systemctl_sockets.fish b/share/functions/__fish_systemctl_sockets.fish index 0fe5b6e8..ecb61ea2 100644 --- a/share/functions/__fish_systemctl_sockets.fish +++ b/share/functions/__fish_systemctl_sockets.fish @@ -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 |