openrc/zsh-completion/_rc-service
2017-12-07 11:30:32 -06:00

28 lines
779 B
Bash

#compdef rc-service
if (( CURRENT == 2 )); then
_arguments -s \
'(-e --exists)'{-e,--exists}"[tests if the service exists or not]" \
'(-l --list)'{-l,--list}'[list all available services]' \
'(-r --resolve)'{-r,--resolve}'[resolve the service name to an init script]' \
'(-C --nocolor)'{-C,--nocolor}'[Disable color output]' \
'(-v --verbose)'{-v,--verbose}'[Run verbosely]' \
'(-q --quiet)'{-q,--quiet}'[Run quietly]'
_values "service" $(rc-service --list)
else
case $words[2] in
-e|--exists|-r|--resolve)
(( CURRENT > 3 )) && return 0
_values "service" $(rc-service --list)
;;
-*)
return 0
;;
*)
_values "action" stop start restart describe zap
;;
esac
fi
# vim: set et sw=2 ts=2 ft=zsh: