forgot zsh-completion last night

This commit is contained in:
Mike Staszel 2011-06-19 00:36:24 -05:00
parent 8857be7c19
commit 85e87c26d2
2 changed files with 41 additions and 2 deletions

View file

@ -40,7 +40,8 @@ source=(adjtime
rc.shutdown
rc.single
rc.sysinit
wireless.conf.d)
wireless.conf.d
zsh-completion)
md5sums=('f976a1c61c2fb9bd2c30e3fdd0d62b61'
'bb2506a443dd1efe1963aa731be2b7a9'
'3a387fbc7567bb053c9964765a7ea747'
@ -59,7 +60,8 @@ md5sums=('f976a1c61c2fb9bd2c30e3fdd0d62b61'
'bdec56c7d6964875c3b3ecaf3bbe58dd'
'6d77bdeeb65958171881fe15589d8c6a'
'e3dc54a8c8518c79dbffbf687655bb81'
'027576534885b8d5dded9be546057b12')
'027576534885b8d5dded9be546057b12'
'b75f2f05e8272aecf08aabd8c4003b4a')
package() {
cd ${srcdir}

View file

@ -0,0 +1,37 @@
#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|help)
_arguments "*: :"
;;
start)
_arguments "*: :($(comm -23 <(echo /etc/rc.d/*(N-*:t)|tr ' ' '\n') <(echo /run/daemons/*(N:t)|tr ' ' '\n')))"
;;
stop|restart|reload)
_arguments "*: :(/run/daemons/*(N:t))"
;;
*)
_arguments "*: :(/etc/rc.d/*(N-*:t))"
;;
esac
;;
esac
}
_rc.d "$@"
# vim: set ts=2 sw=2 ft=sh noet: