|
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 defaults
_defaults_domains(){
if [[ "`eval echo $PREFIX`" != [/~]* ]]; then
local str="$(_call_program domains defaults domains 2>/dev/null)"
local expl
local -a list
list=( ${(s/, /)str} -g -globalDomain )
_wanted domains expl 'defaults database domain' \
compadd -M 'r:|.=* r:|=*' -a list
else
_files -g '*.plist(e:"reply=\${REPLY%.plist}":)'
fi
}
_defaults_keys(){
local ks
ks=(${${${${(M)${(f)"$(defaults read "$words[2]" 2>/dev/null)"}:# [^ ]*=*}# }%% = *}:Q})
local expl
_wanted keys expl 'key' compadd "$ks[@]"
}
_defaults(){
local -a _1st_arguments
_1st_arguments=( read read-type write rename delete domains find help )
local curcontext="$curcontext" state line expl
_arguments -A '-*' \
'(-currentHost)-host:host:_hosts' \
'(-host)-currentHost' \
'*::command:->subcmd' && return 0
if (( CURRENT == 1 )); then
_describe -t commands "command" _1st_arguments
return
fi
case $words[1] in
read|read-type|delete)
_arguments \
"(1)-app:application:_mac_applications" \
"(-app)1:domain:_defaults_domains" \
"2:keys:_defaults_keys"
;;
write)
_arguments \
"(1)-app:application:_mac_applications" \
"(-app)1:domain:_defaults_domains" \
"2:key:_defaults_keys" \
"*::value"
;;
rename)
_arguments \
"(1)-app:application:_mac_applications" \
"(-app)1:domain:_defaults_domains" \
"2:old key:_defaults_keys" \
"3:new key:_defaults_keys"
;;
domains|help)
;;
find)
_message word
;;
*)
_message "unknown defaults command: $words[1]"
;;
esac
}
_defaults "$@"