aboutsummaryrefslogtreecommitdiff
path: root/zsh-completion/_rc-update
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2017-12-07 11:30:32 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2017-12-07 11:30:32 -0600
commit6c456f9383ab0000527b4363bc82fc17850aba18 (patch)
treea481adfeaf5db2dd56c3b87538f1269ad68ef1d2 /zsh-completion/_rc-update
parentd220fc272337b216bff6ac781a7b6be4e6f3caee (diff)
Add zsh-completion support
Diffstat (limited to 'zsh-completion/_rc-update')
-rw-r--r--zsh-completion/_rc-update31
1 files changed, 31 insertions, 0 deletions
diff --git a/zsh-completion/_rc-update b/zsh-completion/_rc-update
new file mode 100644
index 00000000..5bd3c85c
--- /dev/null
+++ b/zsh-completion/_rc-update
@@ -0,0 +1,31 @@
+#compdef rc-update
+
+local used_init
+used_init=(${=${(M)${(f)"$(rc-update show 2>/dev/null)"}:#*|*[a-z]*}% |*})
+
+if (( CURRENT == 2 )); then
+ _values "rc-update actions" \
+ 'add[Add script to a runlevel]' \
+ 'del[Delete script from a runlevel]' \
+ 'show[Show scripts in a runlevel]' \
+ '-a[Process all runlevels]' \
+ '-s[Stack a runlevel instead of a service]'
+elif (( CURRENT == 3 )); then
+ case "$words[2]" in
+ add)
+ _values "service" $(rc-service --list)
+ ;;
+ del)
+ _values "service" $used_init
+ ;;
+ show)
+ _values "runlevels" $(rc-status --list) \
+ '-v[Show all service scripts]' \
+ '--verbose[Show all service scripts]'
+ ;;
+ esac
+elif (( CURRENT == 4 )); then
+ _values "runlevels" $(rc-status --list)
+fi
+
+# vim: set et sw=2 ts=2 ft=zsh: