about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
Diffstat (limited to 'Completion')
-rw-r--r--Completion/SysV/.distfiles4
-rw-r--r--Completion/SysV/_sysv_initscripts17
2 files changed, 21 insertions, 0 deletions
diff --git a/Completion/SysV/.distfiles b/Completion/SysV/.distfiles
new file mode 100644
index 000000000..7864466f0
--- /dev/null
+++ b/Completion/SysV/.distfiles
@@ -0,0 +1,4 @@
+DISTFILES_SRC='
+    .distfiles
+    _sysv_initscripts
+'
diff --git a/Completion/SysV/_sysv_initscripts b/Completion/SysV/_sysv_initscripts
new file mode 100644
index 000000000..2f0a520f9
--- /dev/null
+++ b/Completion/SysV/_sysv_initscripts
@@ -0,0 +1,17 @@
+#compdef -p /etc/(init|rc[0-9S]).d/*
+
+local stdargs nonstdargs expl
+
+if [[ -f $words[1] ]]
+then
+nonstdargs=(${${(s: :)${${${${(M)${(f)"$(<$words[1])"}:#[	 a-z-|]##\)*}%\)*}##\ #}:gs/|/ /}:s/	//}:#(start|stop|restart|force-reload|reload)})
+stdargs=(${(M)${(s: :)${${${${(M)${(f)"$(<$words[1])"}:#[	 a-z-|]##\)*}%\)*}##\ #}:gs/|/ /}:s/	//}:#(start|stop|restart|force-reload|reload)})
+else
+nonstdargs=()
+stdargs=(start stop restart force-reload)
+fi
+
+_tags nonstdargs stdargs
+
+_wanted -V stdargs expl "standard arguments" compadd -a stdargs
+_wanted nonstdargs expl "non-standard arguments" compadd -a nonstdargs