|
Server : Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 System : Linux server.jackjohnson.com 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64 User : jackjohn ( 502) PHP Version : 5.3.17 Disable Function : NONE Directory : /usr/share/zsh/4.3.10/functions/ |
Upload File : |
#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 describe extract import validate export inventory delete addpropvalue delpropvalue )
if [[ $service == "svccfg" ]]; then
_arguments -s \
'-?[Help]' \
'-v[Verbose]' \
'-s[FMRI on which to operate]:fmri:_svcs_fmri -c' \
- set1 \
'-f[Read commands from file]:command file:_files' \
- set2 \
'*::command:->subcmd' && return 0
if (( CURRENT == 1 )); then
_wanted commands expl 'svccfg subcommand' compadd -a subcmds
return
fi
service="$words[1]"
curcontext="${curcontext%:*}=$service:"
fi
case $service in
(import)
_arguments \
'-V[Verify property updates]' \
':file:_files'
;;
(apply|inventory)
_files
;;
(validate)
_alternative 'files:file:_files' 'fmris:fmri:_svc_fmri -c'
;;
(export)
_svcs_fmri -c
;;
(delete)
_arguments \
'-f[Force deletion if online or degraded]' \
'*: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)
;;
(*)
_message "unknown svccfg subcommand: $service"
;;
esac
}
_svccfg "$@"
# vi:tw=0