From f6e9b229d9f7513c1f0993edd5cd48fdcd941959 Mon Sep 17 00:00:00 2001 From: daten-kieker Date: Mon, 18 Feb 2019 14:46:57 +0100 Subject: [PATCH] Use latest version instead of first one Instead of using the first version among the candidates found take the last one. Since versions are sorted alphabetically this should be the latest installed version. Solves #3 --- etc/pyenv.d/which/whence.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/pyenv.d/which/whence.bash b/etc/pyenv.d/which/whence.bash index 11a84fe..7faf04f 100755 --- a/etc/pyenv.d/which/whence.bash +++ b/etc/pyenv.d/which/whence.bash @@ -2,8 +2,8 @@ if [ -n "$PYENV_COMMAND" ] && [ ! -x "$PYENV_COMMAND_PATH" ]; then versions=($(pyenv-whence "${PYENV_COMMAND}" 2>/dev/null || true)) if [ -n "${versions}" ]; then if [ "${#versions[@]}" -gt 1 ]; then - echo "pyenv-implicit: found multiple ${PYENV_COMMAND} in pyenv. Use version ${versions[0]}." 1>&2 + echo "pyenv-implicit: found multiple ${PYENV_COMMAND} in pyenv. Use version ${versions[-1]}." 1>&2 fi - PYENV_COMMAND_PATH="${PYENV_ROOT}/versions/${versions[0]}/bin/${PYENV_COMMAND}" + PYENV_COMMAND_PATH="${PYENV_ROOT}/versions/${versions[-1]}/bin/${PYENV_COMMAND}" fi fi