2012-08-31 02:23:41 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
[ -n "$PYENV_DEBUG" ] && set -x
|
|
|
|
|
2012-08-31 03:09:46 -04:00
|
|
|
IFS=: PYENV_VERSION_NAMES=($(pyenv-version-name))
|
2012-08-31 02:23:41 -04:00
|
|
|
|
|
|
|
if [ "$1" = "--bare" ]; then
|
|
|
|
hit_prefix=""
|
|
|
|
miss_prefix=""
|
2012-08-31 03:09:46 -04:00
|
|
|
print_version="$PYENV_VERSION_NAMES"
|
2012-08-31 02:23:41 -04:00
|
|
|
else
|
|
|
|
hit_prefix="* "
|
|
|
|
miss_prefix=" "
|
2012-08-31 03:09:46 -04:00
|
|
|
print_version="$PYENV_VERSION_NAMES (set by $(pyenv-version-origin))"
|
2012-08-31 02:23:41 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
for path in "${PYENV_ROOT}/versions/"*; do
|
|
|
|
if [ -d "$path" ]; then
|
|
|
|
version="${path##*/}"
|
|
|
|
|
2012-08-31 03:09:46 -04:00
|
|
|
if [ "$version" == "$PYENV_VERSION_NAMES" ]; then
|
2012-08-31 02:23:41 -04:00
|
|
|
echo "${hit_prefix}${print_version}"
|
|
|
|
else
|
|
|
|
echo "${miss_prefix}${version}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|