diff --git a/plugins/composer/composer.plugin.zsh b/plugins/composer/composer.plugin.zsh index d00813e3..cc555927 100644 --- a/plugins/composer/composer.plugin.zsh +++ b/plugins/composer/composer.plugin.zsh @@ -4,6 +4,17 @@ # AUTHOR: Daniel Gomes (me@danielcsgomes.com) # VERSION: 1.0.0 # ------------------------------------------------------------------------------ +# +# USAGE +# ----- +# +# Enable caching: +# +# If you want to use the cache, set the followings in your .zshrc: +# +# zstyle ':completion:*' use-cache yes +# +# ------------------------------------------------------------------------------ # Composer basic command completion _composer_get_command_list () { @@ -51,5 +62,12 @@ alias cgrm='composer global remove' # install composer in the current directory alias cget='curl -s https://getcomposer.org/installer | php' +_retrieve_cache 'composer' + +if [[ -z $__composer_bin_dir ]]; then + __composer_bin_dir=$(composer global config bin-dir --absolute 2>/dev/null) + _store_cache 'composer' __composer_bin_dir +fi + # Add Composer's global binaries to PATH -export PATH=$PATH:$(composer global config bin-dir --absolute 2>/dev/null) +export PATH=$PATH:$__composer_bin_dir