Debian Codegraph @

zsh-completion/_rc-update

raw
1 #compdef rc-update
2
3 _rc_actions() {
4 _values "actions" \
5 'add[Add the service to the runlevel or the current one if none given]' \
6 'del[Delete the service from the runlevel or the current one if none given]' \
7 'show[Show all enabled services and the runlevels they belong to]'
8 }
9
10 _rc_service() {
11 case $line[1] in
12 add)
13 _values "service" $(rc-service "${opt_args[(i)-U|--user]}" --list)
14 ;;
15 del)
16 _values "service" ${=${(M)${(f)"$(rc-update ${opt_args[(i)-U|--user]} show 2>/dev/null)"}:#*|*[a-z]*}% |*}
17 ;;
18 show)
19 _values "runlevels" $(rc-status "${opt_args[(i)-U|--user]}" --list)
20 _values "options" '(-v --verbose)'{-v,--verbose}'[Show all service scripts]'
21 ;;
22 esac
23 }
24
25 _rc_runlevels() {
26 if [[ $line[1] == show ]]; then
27 _nothing
28 else
29 _values "runlevels" $(rc-status "${opt_args[(i)-U|--user]}" --list)
30 fi
31 }
32
33 _arguments -C -s \
34 '(-a --all)'{-a,--all}'[Process all runlevels]' \
35 '(-s --stack)'{-s,--stack}'[Stack a runlevel instead of a service]' \
36 '(-u --update)'{-u,--update}'[Force an update of the dependency tree]' \
37 '(- :)'{-h,--help}'[Display this help output]' \
38 '(-C --nocolor)'{-C,--nocolor}'[Disable color output]' \
39 '(- :)'{-V,--version}'[Display software version]' \
40 '(-v --verbose)'{-v,--verbose}'[Run verbosely]' \
41 '(-q --quiet)'{-q,--quiet}'[Run quietly (repeat to suppress errors)]' \
42 '(-U --user)'{-U,--user}'[Run in user mode]' \
43 '1:actions:_rc_actions' \
44 '2:service:_rc_service' \
45 '3:runlevels:_rc_runlevels'
46
47 # vim: set et sw=2 ts=2 ft=zsh: