mirror of
https://github.com/dcarrillo/prezto.git
synced 2025-07-01 10:29:25 +00:00
[Fix #202] Load modules all or nothing
This commit is contained in:
@ -5,18 +5,22 @@
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
if (( ! $+commands[npm] )); then
|
||||
# Return if requirements are not found.
|
||||
if (( ! $+commands[node] )); then
|
||||
return 1
|
||||
fi
|
||||
|
||||
cache_file="${0:h}/cache.zsh"
|
||||
# Load NPM completion.
|
||||
if (( $+commands[npm] )); then
|
||||
cache_file="${0:h}/cache.zsh"
|
||||
|
||||
if [[ "$commands[npm]" -nt "$cache_file" || ! -s "$cache_file" ]]; then
|
||||
# npm is slow; cache its output.
|
||||
npm completion >! "$cache_file" 2> /dev/null
|
||||
if [[ "$commands[npm]" -nt "$cache_file" || ! -s "$cache_file" ]]; then
|
||||
# npm is slow; cache its output.
|
||||
npm completion >! "$cache_file" 2> /dev/null
|
||||
fi
|
||||
|
||||
source "$cache_file"
|
||||
|
||||
unset cache_file
|
||||
fi
|
||||
|
||||
source "$cache_file"
|
||||
|
||||
unset cache_file
|
||||
|
||||
|
Reference in New Issue
Block a user