Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: completion for SysV initscripts



This is perhaps a bit too Debian-centric, but should be okay
on any OS if the script uses a case statement.

Index: Completion/SysV/.distfiles
===================================================================
RCS file: .distfiles
diff -N .distfiles
--- /dev/null	Mon Dec 11 17:26:27 2000
+++ .distfiles	Sun Mar 18 06:08:22 2001
@@ -0,0 +1,4 @@
+DISTFILES_SRC='
+    .distfiles
+    _sysv_initscripts
+'
Index: Completion/SysV/_sysv_initscripts
===================================================================
RCS file: _sysv_initscripts
diff -N _sysv_initscripts
--- /dev/null	Mon Dec 11 17:26:27 2000
+++ _sysv_initscripts	Sun Mar 18 06:08:22 2001
@@ -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



Messages sorted by: Reverse Date, Date, Thread, Author