pyenv: only run if pyenv not in $PATH (#8462)
This is needed if in between the update of `$PATH` the `$commands` parameter hasn't
been updated, i.e. if there was no `rehash` or `hash -rf` or automatic rehash.
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
Diff
1diff --git a/plugins/pyenv/pyenv.plugin.zsh b/plugins/pyenv/pyenv.plugin.zsh
2index 40e58b5c243b9f4c7a40c5470c78a51c0b7b2f9e..4c75156bd989e07fb301c62e86d072d081127e2f 100644
3--- a/plugins/pyenv/pyenv.plugin.zsh
4+++ b/plugins/pyenv/pyenv.plugin.zsh
5@@ -1,7 +1,8 @@
6 # This plugin loads pyenv into the current shell and provides prompt info via
7 # the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available.
8 9-FOUND_PYENV=$+commands[pyenv]
10+# Load pyenv only if command not already available
11+command -v pyenv &> /dev/null && FOUND_PYENV=1 || FOUND_PYENV=0
1213 if [[ $FOUND_PYENV -ne 1 ]]; then
14 pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv" "/usr/local/opt/pyenv")