|
1 #compdef svcadm |
|
2 |
|
3 _svcadm() { |
|
4 local context state line subcmds |
|
5 typeset -A opt_args |
|
6 |
|
7 subcmds=( enable disable restart refresh mark clear milestone ) |
|
8 |
|
9 if [[ $service == "svcadm" ]]; then |
|
10 _arguments -C -A "-*" \ |
|
11 '-v[Print actions verbosely]' \ |
|
12 '*::command:->subcmd' && return 0 |
|
13 |
|
14 if (( CURRENT == 1 )); then |
|
15 _wanted commands expl 'svcadm subcommand' compadd -a subcmds |
|
16 return |
|
17 fi |
|
18 service="$words[1]" |
|
19 curcontext="${curcontext%:*}=$service:" |
|
20 fi |
|
21 |
|
22 case $service in |
|
23 (enable) |
|
24 _arguments -A "-*" \ |
|
25 '-r[Recursively enable dependencies]' \ |
|
26 '-s[Wait for service to come online]' \ |
|
27 '-t[State change is temporary]' \ |
|
28 '*:instance FMRI:_svcs_fmri -i' |
|
29 ;; |
|
30 |
|
31 (disable) |
|
32 _arguments -A "-*" \ |
|
33 '-s[Wait for service to become disabled]' \ |
|
34 '-t[State change is temporary]' \ |
|
35 '*:instance FMRI:_svcs_fmri -i' |
|
36 ;; |
|
37 |
|
38 (mark) |
|
39 _arguments -A "-*" \ |
|
40 '-I[Change state immediately]' \ |
|
41 '-t[State change is temporary]' \ |
|
42 ':state:(degraded maintenance)' \ |
|
43 ':instance FMRI:_svcs_fmri -i' |
|
44 ;; |
|
45 |
|
46 (restart|refresh|clear) |
|
47 _arguments \ |
|
48 '*:instance FMRI:_svcs_fmri -i' |
|
49 ;; |
|
50 |
|
51 (milestone) |
|
52 _arguments -A "-*" \ |
|
53 '-d[Make milestone the default]' \ |
|
54 '*:milestone FMRI:_svcs_fmri -m' |
|
55 ;; |
|
56 |
|
57 # # The delegate subcommand has been removed, replaced by just using |
|
58 # # the restarter fmri |
|
59 # (delegate) |
|
60 # _arguments \ |
|
61 # '1:restarter FMRI:_svcs_fmri -r' \ |
|
62 # '*:instance FMRI:_svcs_fmri -i' |
|
63 # ;; |
|
64 |
|
65 (*) |
|
66 _message "unknown svcadm subcommand: $service" |
|
67 esac |
|
68 } |
|
69 |
|
70 _svcadm "$@" |