about summary refs log tree commit diff
path: root/Completion/Solaris/Command/_svccfg
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Solaris/Command/_svccfg')
-rw-r--r--Completion/Solaris/Command/_svccfg34
1 files changed, 32 insertions, 2 deletions
diff --git a/Completion/Solaris/Command/_svccfg b/Completion/Solaris/Command/_svccfg
index 59f275f26..5d1bf358a 100644
--- a/Completion/Solaris/Command/_svccfg
+++ b/Completion/Solaris/Command/_svccfg
@@ -1,9 +1,27 @@
 #compdef svccfg
 
+_svccfg_properties() {
+	local -a props fmris
+	local fmri="$argv[$#]"
+
+	# If There's more than one possible FMRI, bail
+	fmris=( ${(f)"$(svcs -H -o fmri $fmri)"} )
+	if [[ $#fmris -gt 1 ]]; then
+		_message "'$fmri' is ambiguous"
+		return 1
+	fi
+
+	# Get all the property names for the FMRI
+	props=( ${${${(f)"$(svccfg -s $fmri describe)"}:# *}%% *} )
+
+	_multi_parts "$expl[@]" - / props
+}
+
 _svccfg() {
 	local context state line subcmds
+	typeset -A opt_args
 
-	subcmds=( apply extract import validate export inventory delete addpropvalue delpropvalue )
+	subcmds=( apply describe extract import validate export inventory delete addpropvalue delpropvalue )
 
 	if [[ $service == "svccfg" ]]; then
 		_arguments -s \
@@ -30,10 +48,14 @@ _svccfg() {
 			':file:_files'
 		;;
 
-	(apply|validate|inventory)
+	(apply|inventory)
 		_files
 		;;
 
+	(validate)
+		_alternative 'files:file:_files' 'fmris:fmri:_svc_fmri -c'
+		;;
+
 	(export)
 		_svcs_fmri -c
 		;;
@@ -44,6 +66,14 @@ _svccfg() {
 			'*:FMRI:_svcs_fmri -c'
 		;;
 
+	(describe)
+		local fmri=$opt_args[-s]
+		_arguments -A "-*" \
+			'-v[Give all information]' \
+			'-t[Show only template data]' \
+			":property group or property:_svccfg_properties $fmri"
+		;;
+
 	(extract)
 		;;