diff options
Diffstat (limited to 'src/_openrc')
-rw-r--r-- | src/_openrc | 150 |
1 files changed, 76 insertions, 74 deletions
diff --git a/src/_openrc b/src/_openrc index 84ecbc8..3a250f4 100644 --- a/src/_openrc +++ b/src/_openrc @@ -6,80 +6,82 @@ local gentoo_runlevels gentoo_runlevels=(/etc/runlevels/*(:t)) case "$service" in - 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" /etc/init.d/*~*.sh(:t) - else - case $words[2] in - -e|--exists|-r|--resolve) - (( CURRENT > 3 )) && return 0 - _values "service" /etc/init.d/*~*.sh(:t) - ;; - -*) - return 0 - ;; - *) - _values "action" stop start restart describe zap - ;; - esac - fi - ;; - rc-update) - local used_init - used_init=(${=${(M)${(f)"$(/sbin/rc-update show 2>/dev/null)"}:#*|*[a-z]*}% |*}) + 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" /etc/init.d/*~*.sh(:t) + else + case $words[2] in + -e|--exists|-r|--resolve) + (( CURRENT > 3 )) && return 0 + _values "service" /etc/init.d/*~*.sh(:t) + ;; + -*) + return 0 + ;; + *) + _values "action" stop start restart describe zap + ;; + esac + fi + ;; + rc-update) + local used_init + used_init=(${=${(M)${(f)"$(/sbin/rc-update show 2>/dev/null)"}:#*|*[a-z]*}% |*}) - if (( CURRENT == 2 )); then - _values "rc-update actions" \ - 'add[Add script to a runlevel]' \ - 'del[Delete script from a runlevel]' \ - 'show[Show scripts lanched at a runlevel]' \ - '-a[Add script to a runlevel]' \ - '-d[Delete script from a runlevel]' \ - '-s[Show scripts lanched at a runlevel]' - elif (( CURRENT == 3 )); then - case "$words[2]" in - add|-a) - _values "service" /etc/init.d/*~*.sh(:t) - ;; - del|-d) - _values "service" $used_init - ;; - show|-s) - _values "runlevels" $gentoo_runlevels \ - '-v[Show all init scripts]' \ - '--verbose[Show all init scripts]' - ;; - esac - elif (( CURRENT == 4 )); then - _values "runlevels" $gentoo_runlevels - fi - ;; - rc-status) - _arguments -s \ - {'(--all)-a','(-a)--all'}'[Show services at all runlevels]' \ - {'(--crashed)-c','(-c)--crashed'}'[Show crashed services]' \ - {'(--list)-l','(-l)--list'}'[Show list of runlevels]' \ - {'(--runlevel)-r','(-r)--runlevel'}'[Show the name of the current runlevel]' \ - {'(--servicelist)-s','(-s)--servicelist'}'[Show all services]' \ - {'(--unused)-u','(-u)--unused'}'[Show services not assigned to any run level]' \ - {'(--help)-h','(-h)--help'}'[Print this help output]' \ - {'(--nocolor)-C','(-C)--nocolor'}'[Disable color output]' \ - {'(--version)-V','(-V)--version'}'[Display software version]' \ - {'(--verbose)-v','(-v)--verbose'}'[Run verbosely]' \ - {'(--quiet)-q','(-q)--quiet'}'[Run quietly (Does not affect errors)]' + if (( CURRENT == 2 )); then + _values "rc-update actions" \ + 'add[Add script to a runlevel]' \ + 'del[Delete script from a runlevel]' \ + 'show[Show scripts lanched at a runlevel]' \ + '-a[Add script to a runlevel]' \ + '-d[Delete script from a runlevel]' \ + '-s[Show scripts lanched at a runlevel]' + elif (( CURRENT == 3 )); then + case "$words[2]" in + add|-a) + _values "service" /etc/init.d/*~*.sh(:t) + ;; + del|-d) + _values "service" $used_init + ;; + show|-s) + _values "runlevels" $gentoo_runlevels \ + '-v[Show all init scripts]' \ + '--verbose[Show all init scripts]' + ;; + esac + elif (( CURRENT == 4 )); then + _values "runlevels" $gentoo_runlevels + fi + ;; + rc-status) + _arguments -s \ + {'(--all)-a','(-a)--all'}'[Show services at all runlevels]' \ + {'(--crashed)-c','(-c)--crashed'}'[Show crashed services]' \ + {'(--list)-l','(-l)--list'}'[Show list of runlevels]' \ + {'(--runlevel)-r','(-r)--runlevel'}'[Show the name of the current runlevel]' \ + {'(--servicelist)-s','(-s)--servicelist'}'[Show all services]' \ + {'(--unused)-u','(-u)--unused'}'[Show services not assigned to any run level]' \ + {'(--help)-h','(-h)--help'}'[Print this help output]' \ + {'(--nocolor)-C','(-C)--nocolor'}'[Disable color output]' \ + {'(--version)-V','(-V)--version'}'[Display software version]' \ + {'(--verbose)-v','(-v)--verbose'}'[Run verbosely]' \ + {'(--quiet)-q','(-q)--quiet'}'[Run quietly (Does not affect errors)]' - _values 'runlevels' $gentoo_runlevels - ;; - rc) - if (( CURRENT == 2 )); then - _values "runlevels" $gentoo_runlevels - fi - ;; + _values 'runlevels' $gentoo_runlevels + ;; + rc) + if (( CURRENT == 2 )); then + _values "runlevels" $gentoo_runlevels + fi + ;; esac + +# vim: set et sw=2 sts=2 ts=2 ft=zsh: |