#compdef invoke-rc.d local state ret=-1 _arguments -C \ '(- 1 *)--help[display usage help]' \ '--quiet[quiet mode, no error messages displayed]' \ '--try-anyway[try to run script while non-fatal error is detected]' \ '--disclose-deny[return status code 101 instead of 0 if the script action is denied]' \ '--query[returns one of the status codes 100-106. Does not run the init script]' \ '--no-fallback[ignore any fallback action requests by the policy]' \ '--force[try to run the init script regardless of policy and errors]' \ '1:service:_services' \ '2:service action:->saction' \ '*::arguments _normal' \ && ret=0 case $state in saction) case $words[CURRENT-1] in --*) ;; *) actions=($(sed -ne "y/|/ /; s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" /etc/init.d/$words[CURRENT-1])) _wanted actions expl actions compadd $actions ;; esac ;; esac return ret