aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/completions/service.fish
diff options
context:
space:
mode:
authorGravatar aliva <ali.vakilzade@gmail.com>2013-03-12 19:13:52 +0330
committerGravatar aliva <ali.vakilzade@gmail.com>2013-03-12 19:13:52 +0330
commit2c7e0ef577bcb7e4b4e24ee7bcb77cf9057290fc (patch)
tree489ceb0cdb635f68ac4ade6962c79494688bb69e /share/completions/service.fish
parent2cbcc8296856ecdde5f67ebcc70b8d38bc169de3 (diff)
service name completion for "systemd service manager" added
Diffstat (limited to 'share/completions/service.fish')
-rw-r--r--share/completions/service.fish9
1 files changed, 8 insertions, 1 deletions
diff --git a/share/completions/service.fish b/share/completions/service.fish
index f9055c9e..f7d2ba95 100644
--- a/share/completions/service.fish
+++ b/share/completions/service.fish
@@ -1,6 +1,13 @@
+function print_service_names
+ if type -f systemctl >/dev/null
+ command systemctl list-units -t service | cut -d ' ' -f 1 | grep '\.service$' | sed -e 's/\.service$//'
+ end
+
+ command ls /etc/init.d
+end
# Fist argument is the names of the service, i.e. a file in /etc/init.d
-complete -c service -n "test (count (commandline -poc)) = 1" -xa "(command ls /etc/init.d)" --description "Service name"
+complete -c service -n "test (count (commandline -poc)) = 1" -xa "(print_service_names)" --description "Service name"
#The second argument is what action to take with the service
complete -c service -n "test (count (commandline -poc)) -gt 1" -xa '$__fish_service_commands'