about summary refs log tree commit diff
path: root/Completion/Solaris/Command/_svcadm
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-07-21 19:15:22 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-07-21 19:15:22 +0000
commit5b29fedad850299950195a1878fe4923778f9dcc (patch)
tree100a2decba0f1b6f8c4ed1b866bddd5f2ff57019 /Completion/Solaris/Command/_svcadm
parent2d2d341161ca6699a6efd6981c3a9fd7fe52e6d6 (diff)
downloadzsh-5b29fedad850299950195a1878fe4923778f9dcc.tar.gz
zsh-5b29fedad850299950195a1878fe4923778f9dcc.tar.xz
zsh-5b29fedad850299950195a1878fe4923778f9dcc.zip
25324: Danek Duvall: some Solaris and more general completions
Diffstat (limited to 'Completion/Solaris/Command/_svcadm')
-rw-r--r--Completion/Solaris/Command/_svcadm70
1 files changed, 70 insertions, 0 deletions
diff --git a/Completion/Solaris/Command/_svcadm b/Completion/Solaris/Command/_svcadm
new file mode 100644
index 000000000..c2e91a6fe
--- /dev/null
+++ b/Completion/Solaris/Command/_svcadm
@@ -0,0 +1,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 "$@"