summaryrefslogtreecommitdiffstats
path: root/Completion/Unix/Command/_init_d
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_init_d')
-rw-r--r--Completion/Unix/Command/_init_d26
1 files changed, 23 insertions, 3 deletions
diff --git a/Completion/Unix/Command/_init_d b/Completion/Unix/Command/_init_d
index cdc373297..939ef102e 100644
--- a/Completion/Unix/Command/_init_d
+++ b/Completion/Unix/Command/_init_d
@@ -1,7 +1,7 @@
#compdef -p */(init|rc[0-9S]#).d/*
-local cmds script
-local -a flags
+local cmds script state
+local -a flags line
_compskip=all
@@ -122,4 +122,24 @@ cmds=( $(_init_d_get_cmds) ) || return 1
(( $#cmds )) || zstyle -a ":completion:${curcontext}:commands" commands cmds ||
cmds=(start stop)
-_arguments -s -A "-*" $flags ':init.d command:_sub_commands $cmds'
+local svcname=$words[1] ret=1
+
+_arguments -C -s -A "-*" $flags \
+ ':init.d command:_sub_commands $cmds' \
+ '*:: :->svcargs' && ret=0
+
+if [[ $state == svcargs ]]; then
+ case $svcname in
+ jail)
+ case $line[1] in
+ *stop|*restart|console|status) _jails && ret=0 ;;
+ *) _jails -c && ret=0 ;;
+ esac
+ ;;
+ *)
+ _call_function ret _init_d-$svcname $line[1]
+ ;;
+ esac
+fi
+
+return ret