summaryrefslogtreecommitdiffstats
path: root/Completion/Unix/Command/_init_d
diff options
context:
space:
mode:
authorNick Price <nick@spun.io>2026-05-19 00:02:09 +0200
committerOliver Kiddle <opk@zsh.org>2026-05-19 00:17:08 +0200
commit2e6560e483b99496ab9e01d5f9f30ca5a0ef61db (patch)
treefb4bc01363b8c464c6aa6660fc197a4c04f40ce6 /Completion/Unix/Command/_init_d
parent54578: relacement for 52373 without breaking use of the format style with a u... (diff)
downloadzsh-2e6560e483b99496ab9e01d5f9f30ca5a0ef61db.tar
zsh-2e6560e483b99496ab9e01d5f9f30ca5a0ef61db.tar.gz
zsh-2e6560e483b99496ab9e01d5f9f30ca5a0ef61db.tar.bz2
zsh-2e6560e483b99496ab9e01d5f9f30ca5a0ef61db.tar.lz
zsh-2e6560e483b99496ab9e01d5f9f30ca5a0ef61db.tar.xz
zsh-2e6560e483b99496ab9e01d5f9f30ca5a0ef61db.tar.zst
zsh-2e6560e483b99496ab9e01d5f9f30ca5a0ef61db.zip
github #166: complete names of non-running FreeBSD jails
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