diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2004-11-12 11:47:41 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2004-11-12 11:47:41 +0000 |
commit | 24a68220a105c70a54baa543917e1022ae3e7a8d (patch) | |
tree | bb89747d3925cbb9c97afef53db3659ecedf027e /Completion/Darwin/Type/_mac_applications | |
parent | e4ba1a2ec8cd6b73d6e931e00e4a5d16e131a473 (diff) | |
download | zsh-24a68220a105c70a54baa543917e1022ae3e7a8d.tar.gz zsh-24a68220a105c70a54baa543917e1022ae3e7a8d.tar.xz zsh-24a68220a105c70a54baa543917e1022ae3e7a8d.zip |
improved Mac completion, from Motoi Washida
Diffstat (limited to 'Completion/Darwin/Type/_mac_applications')
-rw-r--r-- | Completion/Darwin/Type/_mac_applications | 51 |
1 files changed, 3 insertions, 48 deletions
diff --git a/Completion/Darwin/Type/_mac_applications b/Completion/Darwin/Type/_mac_applications index 69b23ea7b..ac1df46c1 100644 --- a/Completion/Darwin/Type/_mac_applications +++ b/Completion/Darwin/Type/_mac_applications @@ -1,51 +1,6 @@ #autoload -_mac_applications_caching_policy () { - # rebuild if cache is more than a day old - oldp=( "$1"(Nmw+1) ) - (( $#oldp )) -} +_retrieve_mac_apps -_mac_applications() { - [[ $PREFIX = */* ]] && return 1 - - local cache_policy - zstyle -s ":completion:*:*:$service:*" cache-policy cache_policy - if [[ -z "$cache_policy" ]]; then - zstyle ":completion:*:*:$service:*" cache-policy _mac_applications_caching_policy - fi - - if ( [[ ${+apps} -eq 0 ]] || _cache_invalid Mac_applications ) \ - && ! _retrieve_cache Mac_applications; then - local app_pattern="*.app" - - local -a app_path - zstyle -s ":completion:${curcontext}:commands" application-dir app_path - if [[ -z "$app_path" ]]; then - local -a apdptn - apdptn="((*~$app_pattern~Data~plugins~*Fonts~Contents)/)#" - app_path=({{/,/Developer,/Network,"$HOME"}/Applications/,"/Applications (Mac OS 9)/"}${~apdptn} "$HOME"/Desktop/{,*~${~app_pattern}(/)}) - fi - - local -a apps - - if ! zstyle -t ":completion:${curcontext}:commands" ignore-extention; then - apps=("${apps[@]}" "${app_path[@]}"/${~app_pattern}) - fi - - if ! zstyle -t ":completion:${curcontext}:commands" ignore-cfm; then - local capps - capps="`awk '/^Joy\!peffpwpc/ {print FILENAME; }; { nextfile }' ${app_path}/(*~*.?~*.??~*.???~*.????)(^/)`" - apps=("${apps[@]}" "${(f)capps}") - fi - - typeset -U apps - apps=("${apps[@]:t:r}") - _store_cache Mac_applications apps - fi - - local expl - _wanted commands expl 'mac os x application' compadd -a apps -} - -_mac_applications "$@" +local expl +_wanted commands expl 'Mac OS X application' compadd -- "${(@)${_mac_apps[@]:t}%.app}" |