diff options
author | Tim Harder <radhermit@gentoo.org> | 2014-03-29 01:22:33 -0700 |
---|---|---|
committer | Tim Harder <radhermit@gentoo.org> | 2014-03-29 01:38:08 -0700 |
commit | 454ecdae27518ef131ee4d42c446dea9ee01386b (patch) | |
tree | 3ddab9d366c21592143ab6be04b710fee319ebd6 | |
parent | _portage_utils: fix arch list to skip comments (diff) | |
download | zsh-completion-454ecdae27518ef131ee4d42c446dea9ee01386b.tar.gz zsh-completion-454ecdae27518ef131ee4d42c446dea9ee01386b.tar.bz2 zsh-completion-454ecdae27518ef131ee4d42c446dea9ee01386b.zip |
move _baselayout to _openrc and update existing support for openrc-0.12.4
-rw-r--r-- | _baselayout | 80 | ||||
-rw-r--r-- | _openrc | 60 |
2 files changed, 60 insertions, 80 deletions
diff --git a/_baselayout b/_baselayout deleted file mode 100644 index 9ff8360..0000000 --- a/_baselayout +++ /dev/null @@ -1,80 +0,0 @@ -#compdef rc-update rc-status rc - -# baselayout 1.12.11.1 -# -# rc (fully done) -# rc-update (fully done) -# rc-status (fully done) - - -local gentoo_runlevels -gentoo_runlevels=(/etc/runlevels/*(:t)) - - -# Stuff for rc -_rc () { - if (( CURRENT == 2 )); then - _values "runlevels" $gentoo_runlevels - fi -} - - -# Stuff for rc-status -_rc-status () { - _arguments -s \ - {'(--all)-a','(-a)--all'}'[Show services at all run levels]' \ - {'(--list)-l','(-l)--list'}'[Show list of run levels]' \ - {'(--nocolor)-nc','(-nc)--nocolor'}'[Disable color output]' \ - {'(--servicelist)-s','(-s)--servicelist'}'[Show all services]' \ - {'(--unused)-u','(-u)--unused'}'[Show services not assigned to any run level]' - - _values 'runlevels' $gentoo_runlevels -} - - -# Stuff for rc-update -_rc-update () { - local used_init - - used_init=(${=${(M)${(f)"$(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 "scripts" /etc/init.d/*~*.sh(:t) - ;; - del|-d) - _values "scripts" $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 -} - - -case "$service" in - rc-update) - _rc-update "$@" && return 0 - ;; - rc-status) - _rc-status "$@" && return 0 - ;; - rc) - _rc "$@" && return 0 - ;; -esac - @@ -0,0 +1,60 @@ +#compdef rc-update rc-status rc + +# openrc-0.12.4 + +local gentoo_runlevels +gentoo_runlevels=(/etc/runlevels/*(:t)) + +case "$service" in + 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)]' + + _values 'runlevels' $gentoo_runlevels + ;; + rc) + if (( CURRENT == 2 )); then + _values "runlevels" $gentoo_runlevels + fi + ;; +esac |