about summary refs log tree commit diff
path: root/Completion/Solaris/Command/_svcadm
blob: c2e91a6fe04df77ce20eaba255c76bf8f2e62a65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#compdef svcadm

_svcadm() {
	local context state line subcmds
	typeset -A opt_args

	subcmds=( enable disable restart refresh mark 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 \
			'-r[Recursively enable dependencies]' \
			'-s[Wait for service to come online]' \
			'-t[State change is temporary]' \
			'*:instance FMRI:_svcs_fmri -i'
		;;

	(disable)
		_arguments \
			'-s[Wait for service to become disabled]' \
			'-t[State change is temporary]' \
			'*:instance FMRI:_svcs_fmri -i'
		;;

	(mark)
		_arguments \
			'-I[Change state immediately]' \
			'-t[State change is temporary]' \
			':state:(degraded maintenance)' \
			':instance FMRI:_svcs_fmri -i'
		;;

	(restart|refresh|clear)
		_arguments \
			'*:instance FMRI:_svcs_fmri -i'
		;;

	(milestone)
		_arguments \
			'-d[Make milestone the default]' \
			'*:milestone FMRI:_svcs_fmri -m'
		;;

# 	# The delegate subcommand has been removed, replaced by just using
# 	# the restarter fmri
# 	(delegate)
# 		_arguments \
# 			'1:restarter FMRI:_svcs_fmri -r' \
# 			'*:instance FMRI:_svcs_fmri -i'
# 		;;

	(*)
		_message "unknown svcadm subcommand: $service"
	esac
}

_svcadm "$@"