2019-04-23 10:23:33 -04:00
|
|
|
#!/usr/bin/env bash
|
2013-01-18 03:41:41 -05:00
|
|
|
# Summary: Show the current Python version and its origin
|
|
|
|
#
|
|
|
|
# Shows the currently selected Python version and how it was
|
|
|
|
# selected. To obtain only the version string, use `pyenv
|
|
|
|
# version-name'.
|
|
|
|
|
2012-08-31 02:23:41 -04:00
|
|
|
set -e
|
|
|
|
[ -n "$PYENV_DEBUG" ] && set -x
|
|
|
|
|
2014-12-11 14:37:03 -05:00
|
|
|
exitcode=0
|
2013-08-15 09:29:14 -04:00
|
|
|
OLDIFS="$IFS"
|
2014-12-11 14:37:03 -05:00
|
|
|
IFS=: PYENV_VERSION_NAMES=($(pyenv-version-name)) || exitcode=$?
|
2013-08-15 09:29:14 -04:00
|
|
|
IFS="$OLDIFS"
|
2012-08-31 03:09:46 -04:00
|
|
|
|
|
|
|
for PYENV_VERSION_NAME in "${PYENV_VERSION_NAMES[@]}"; do
|
|
|
|
echo "$PYENV_VERSION_NAME (set by $(pyenv-version-origin))"
|
|
|
|
done
|
2014-12-11 14:37:03 -05:00
|
|
|
|
|
|
|
exit $exitcode
|