mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-04 06:14:50 +01:00
78 lines
1.8 KiB
Text
78 lines
1.8 KiB
Text
#compdef svcadm
|
|
|
|
_svcadm() {
|
|
local context state line subcmds
|
|
typeset -A opt_args
|
|
|
|
subcmds=( enable disable restart refresh mark delegate clear milestone )
|
|
|
|
if [[ $service == "svcadm" ]]; then
|
|
_arguments -C -A "-*" \
|
|
'-v[Print actions verbosely]' \
|
|
'*::command:->subcmd' && return 0
|
|
|
|
if (( CURRENT == 1 )); then
|
|
_wanted commands expl 'svcadm subcommand' compadd -a subcmds
|
|
return
|
|
fi
|
|
service="$words[1]"
|
|
curcontext="${curcontext%:*}=$service:"
|
|
fi
|
|
|
|
case $service in
|
|
(enable)
|
|
_arguments -A "-*" \
|
|
'-r[Recursively enable dependencies]' \
|
|
'-s[Wait for service to come online]' \
|
|
'-T[Timeout for -s]:seconds:' \
|
|
'-t[State change is temporary]' \
|
|
'*:instance FMRI:_svcs_fmri -i'
|
|
;;
|
|
|
|
(disable)
|
|
_arguments -A "-*" \
|
|
'-s[Wait for service to become disabled]' \
|
|
'-T[Timeout for -s]:seconds:' \
|
|
'-t[State change is temporary]' \
|
|
'*:instance FMRI:_svcs_fmri -i'
|
|
;;
|
|
|
|
(mark)
|
|
_arguments -A "-*" \
|
|
'-I[Change state immediately]' \
|
|
"-s[Wait for service to reach the new state]" \
|
|
'-T[Timeout for -s]:seconds:' \
|
|
'-t[State change is temporary]' \
|
|
':state:(degraded maintenance)' \
|
|
':instance FMRI:_svcs_fmri -i'
|
|
;;
|
|
|
|
(restart|refresh|clear)
|
|
_arguments \
|
|
"-s[Wait for service to $service]" \
|
|
'-T[Timeout for -s]:seconds:' \
|
|
'*:instance FMRI:_svcs_fmri -i'
|
|
;;
|
|
|
|
(delegate)
|
|
_arguments -A "-*" \
|
|
'-s[Wait for instances to come online]' \
|
|
'-T[Timeout for -s]:seconds:' \
|
|
':restarter FMRI:_svcs_fmri -r' \
|
|
'*:FMRI:_svcs_fmri -i'
|
|
;;
|
|
|
|
(milestone)
|
|
_arguments -A "-*" \
|
|
'-d[Make milestone the default]' \
|
|
'-s[Wait for the transition to the new milestone]' \
|
|
'-T[Timeout for -s]:seconds:' \
|
|
'*:milestone FMRI:_svcs_fmri -m'
|
|
;;
|
|
|
|
(*)
|
|
_message "unknown svcadm subcommand: $service"
|
|
esac
|
|
}
|
|
|
|
_svcadm "$@"
|