|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /usr/share/zsh/4.2.6/functions/ |
Upload File : |
#compdef defaults
_defaults_domains(){
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
}
_defaults_keys(){
local ks="$(_call_program keys defaults read "$words[2]" 2>/dev/null | sed '/^ [[:alpha:]"]/ { s/^ //; s/ = .*$//; p;}; d')"
local expl
_wanted keys expl 'key' compadd ${(f)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 "$@"