commit:     7134714bf6a778c13aa5b602a2b1f47c1ddbe008
Author:     Vadim A. Misbakh-Soloviov <mva <AT> mva <DOT> name>
AuthorDate: Mon Aug 25 11:24:50 2014 +0000
Commit:     Vadim A. Misbakh-Soloviov <mva <AT> mva <DOT> name>
CommitDate: Mon Aug 25 11:24:50 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/zsh-completion.git;a=commit;h=7134714b

_openrc: rc-service support

Signed-off-by: Vadim A. Misbakh-Soloviov <mva <AT> mva.name>

---
 _openrc | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/_openrc b/_openrc
index fd3259d..10519f3 100644
--- a/_openrc
+++ b/_openrc
@@ -1,4 +1,4 @@
-#compdef rc-update rc-status rc
+#compdef rc-update rc-status rc rc-service
 
 # openrc-0.12.4
 
@@ -6,6 +6,31 @@ local gentoo_runlevels
 gentoo_runlevels=(/etc/runlevels/*(:t))
 
 case "$service" in
+       rc-service)
+               if (( CURRENT == 2 )); then
+                       _arguments -s \
+                               '(-e --exists)'{-e,--exists}"[tests if the 
service exists or not]" \
+                               '(-l --list)'{-l,--list}'[list all available 
services]' \
+                               '(-r --resolve)'{-r,--resolve}'[resolve the 
service name to an init script]' \
+                               '(-C --nocolor)'{-C,--nocolor}'[Disable color 
output]' \
+                               '(-v --verbose)'{-v,--verbose}'[Run verbosely]' 
\
+                               '(-q --quiet)'{-q,--quiet}'[Run quietly]'
+                               _values "service" /etc/init.d/*~*.sh(:t)
+               else
+                       case $words[2] in
+                               -e|--exists|-r|--resolve)
+                                       (( CURRENT > 3 )) && return 0
+                                       _values "service" /etc/init.d/*~*.sh(:t)
+                               ;;
+                               -*)
+                                       return 0
+                               ;;
+                               *)
+                                       _values "action" stop start restart 
describe zap
+                               ;;
+                       esac
+               fi
+               ;;
        rc-update)
                local used_init
                used_init=(${=${(M)${(f)"$(/sbin/rc-update show 
2>/dev/null)"}:#*|*[a-z]*}% |*})
@@ -58,3 +83,12 @@ case "$service" in
                fi
                ;;
 esac
+
+
+# Local Variables:
+# mode: Shell-Script
+# sh-indentation: 2
+# indent-tabs-mode: nil
+# sh-basic-offset: 2
+# End:
+# vim: ft=zsh sw=2 ts=2 et

Reply via email to