about summary refs log tree commit diff
path: root/Completion/Unix/Type
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Type')
-rw-r--r--Completion/Unix/Type/_services8
1 files changed, 7 insertions, 1 deletions
diff --git a/Completion/Unix/Type/_services b/Completion/Unix/Type/_services
index 40136e3c1..496054795 100644
--- a/Completion/Unix/Type/_services
+++ b/Completion/Unix/Type/_services
@@ -3,7 +3,13 @@
 local -a inits xinetds alls
 local expl ret=1
 
-if chkconfig --list > /dev/null 2>&1; then
+if [[ $OSTYPE = freebsd* ]]; then
+  if [[ -x /usr/sbin/service ]]; then
+    alls=( $(service -l) ) && ret=0
+
+    _wanted services expl service compadd "$@" - $alls[@] && ret=0
+  fi
+elif chkconfig --list > /dev/null 2>&1; then
   alls=( ${(f)"$(LANGUAGE=C LANG=C LC_ALL=C chkconfig --list)"} )
   inits=( ${${${alls[1,(r)xinetd based*]}[1,-2]}/%[[:space:]]*/} )
   xinetds=( ${${${${alls[(r)xinetd based*,-1]}[2,-1]}/#[[:space:]]#}/%:*} )