2011-06-19 05:36:24 +00:00
|
|
|
#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
|
2011-08-08 04:11:13 +00:00
|
|
|
help)
|
2011-06-19 05:36:24 +00:00
|
|
|
_arguments "*: :"
|
|
|
|
;;
|
2011-08-08 04:11:13 +00:00
|
|
|
list)
|
|
|
|
_arguments "2: :(started stopped)"
|
|
|
|
;;
|
2011-06-19 05:36:24 +00:00
|
|
|
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:
|