components/zsh/Completion/Solaris/Command/_svcadm
branchs11-update
changeset 3021 b9308977c65b
parent 3020 a14aae53a1c7
child 3023 90190872ae3e
equal deleted inserted replaced
3020:a14aae53a1c7 3021:b9308977c65b
     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 delegate 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[Synchronous mode: wait for service to come online]' \
       
    27 			'-T[Timeout for synchronous mode]:seconds:' \
       
    28 			'-t[State change is temporary]' \
       
    29 			'*:instance FMRI:_svcs_fmri -i'
       
    30 		;;
       
    31 
       
    32 	(disable)
       
    33 		_arguments -A "-*" \
       
    34 			'-s[Synchronous mode: wait for service to become disabled]' \
       
    35 			'-T[Timeout for synchronous mode]:seconds:' \
       
    36 			'-t[State change is temporary]' \
       
    37 			'*:instance FMRI:_svcs_fmri -i'
       
    38 		;;
       
    39 
       
    40 	(mark)
       
    41 		_arguments -A "-*" \
       
    42 			'-I[Change state immediately]' \
       
    43 			"-s[Synchronous mode: wait for service to reach the new state]" \
       
    44 			'-T[Timeout for synchronous mode]:seconds:' \
       
    45 			'-t[State change is temporary]' \
       
    46 			':state:(degraded maintenance)' \
       
    47 			':instance FMRI:_svcs_fmri -i'
       
    48 		;;
       
    49 
       
    50 	(restart|refresh|clear)
       
    51 		_arguments \
       
    52 			"-s[Synchronous mode: wait for service to $service]" \
       
    53 			'-T[Timeout for synchronous mode]:seconds:' \
       
    54 			'*:instance FMRI:_svcs_fmri -i'
       
    55 		;;
       
    56 
       
    57 	(delegate)
       
    58 		_arguments -A "-*" \
       
    59 			'-s[Synchronous mode: wait for instances to come online]' \
       
    60 			'-T[Timeout for synchronous mode]:seconds:' \
       
    61 			':restarter FMRI:_svcs_fmri -r' \
       
    62 			'*:FMRI:_svcs_fmri -i'
       
    63 		;;
       
    64 
       
    65 	(milestone)
       
    66 		_arguments -A "-*" \
       
    67 			'-d[Make milestone the default]' \
       
    68 			'-s[Synchronous mode: wait for the transition to the new milestone]' \
       
    69 			'-T[Timeout for synchronous mode]:seconds:' \
       
    70 			'*:milestone FMRI:_svcs_fmri -m'
       
    71 		;;
       
    72 
       
    73 	(*)
       
    74 		_message "unknown svcadm subcommand: $service"
       
    75 	esac
       
    76 }
       
    77 
       
    78 _svcadm "$@"