1 |
commit: 7134714bf6a778c13aa5b602a2b1f47c1ddbe008 |
2 |
Author: Vadim A. Misbakh-Soloviov <mva <AT> mva <DOT> name> |
3 |
AuthorDate: Mon Aug 25 11:24:50 2014 +0000 |
4 |
Commit: Vadim A. Misbakh-Soloviov <mva <AT> mva <DOT> name> |
5 |
CommitDate: Mon Aug 25 11:24:50 2014 +0000 |
6 |
URL: http://sources.gentoo.org/gitweb/?p=proj/zsh-completion.git;a=commit;h=7134714b |
7 |
|
8 |
_openrc: rc-service support |
9 |
|
10 |
Signed-off-by: Vadim A. Misbakh-Soloviov <mva <AT> mva.name> |
11 |
|
12 |
--- |
13 |
_openrc | 36 +++++++++++++++++++++++++++++++++++- |
14 |
1 file changed, 35 insertions(+), 1 deletion(-) |
15 |
|
16 |
diff --git a/_openrc b/_openrc |
17 |
index fd3259d..10519f3 100644 |
18 |
--- a/_openrc |
19 |
+++ b/_openrc |
20 |
@@ -1,4 +1,4 @@ |
21 |
-#compdef rc-update rc-status rc |
22 |
+#compdef rc-update rc-status rc rc-service |
23 |
|
24 |
# openrc-0.12.4 |
25 |
|
26 |
@@ -6,6 +6,31 @@ local gentoo_runlevels |
27 |
gentoo_runlevels=(/etc/runlevels/*(:t)) |
28 |
|
29 |
case "$service" in |
30 |
+ rc-service) |
31 |
+ if (( CURRENT == 2 )); then |
32 |
+ _arguments -s \ |
33 |
+ '(-e --exists)'{-e,--exists}"[tests if the service exists or not]" \ |
34 |
+ '(-l --list)'{-l,--list}'[list all available services]' \ |
35 |
+ '(-r --resolve)'{-r,--resolve}'[resolve the service name to an init script]' \ |
36 |
+ '(-C --nocolor)'{-C,--nocolor}'[Disable color output]' \ |
37 |
+ '(-v --verbose)'{-v,--verbose}'[Run verbosely]' \ |
38 |
+ '(-q --quiet)'{-q,--quiet}'[Run quietly]' |
39 |
+ _values "service" /etc/init.d/*~*.sh(:t) |
40 |
+ else |
41 |
+ case $words[2] in |
42 |
+ -e|--exists|-r|--resolve) |
43 |
+ (( CURRENT > 3 )) && return 0 |
44 |
+ _values "service" /etc/init.d/*~*.sh(:t) |
45 |
+ ;; |
46 |
+ -*) |
47 |
+ return 0 |
48 |
+ ;; |
49 |
+ *) |
50 |
+ _values "action" stop start restart describe zap |
51 |
+ ;; |
52 |
+ esac |
53 |
+ fi |
54 |
+ ;; |
55 |
rc-update) |
56 |
local used_init |
57 |
used_init=(${=${(M)${(f)"$(/sbin/rc-update show 2>/dev/null)"}:#*|*[a-z]*}% |*}) |
58 |
@@ -58,3 +83,12 @@ case "$service" in |
59 |
fi |
60 |
;; |
61 |
esac |
62 |
+ |
63 |
+ |
64 |
+# Local Variables: |
65 |
+# mode: Shell-Script |
66 |
+# sh-indentation: 2 |
67 |
+# indent-tabs-mode: nil |
68 |
+# sh-basic-offset: 2 |
69 |
+# End: |
70 |
+# vim: ft=zsh sw=2 ts=2 et |