aboutsummaryrefslogtreecommitdiff
path: root/zsh-completion
diff options
context:
space:
mode:
authorClément Démoulins <clement@archivel.fr>2011-05-18 22:16:02 +0200
committerSebastien Luttringer <seblu@seblu.net>2011-05-22 18:27:17 +0200
commit395803ff628e41940bbaaf5f1ffbcf591b007102 (patch)
treebb5059e3cf71b12159c9ef7330d0b5583136802c /zsh-completion
parentd543c7aa098c214fa5e55a497353dda47b95d3ad (diff)
downloadinitscripts-395803ff628e41940bbaaf5f1ffbcf591b007102.tar.xz
Add a zsh completion script for the command rc.d.
seblu: Fix typo, add vim modeline Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
Diffstat (limited to 'zsh-completion')
-rw-r--r--zsh-completion34
1 files changed, 34 insertions, 0 deletions
diff --git a/zsh-completion b/zsh-completion
new file mode 100644
index 0000000..bf8d9d0
--- /dev/null
+++ b/zsh-completion
@@ -0,0 +1,34 @@
+#compdef rc.d
+
+_rc.d () {
+ local curcontext="$curcontext" state line
+ typeset -A opt_args
+
+ _arguments "1: :->action" "*: :->service"
+
+ case $state in
+ action)
+ _arguments "1:action:(list help start stop restart)"
+ ;;
+ service)
+ local action="$words[2]"
+ curcontext="${curcontext%:*:*}:rc.d-${action}:"
+
+ case $action in
+ list)
+ _arguments "*: :"
+ ;;
+ help)
+ _arguments "*: :"
+ ;;
+ *)
+ _arguments "*: :_services"
+ ;;
+ esac
+ ;;
+ esac
+}
+
+_rc.d "$@"
+
+# vim: set ts=2 sw=2 ft=sh noet: