mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-07 20:31:01 -05:00
Merge pull request #287 from mislav/versions-fix
fix `versions` in case current version doesn't exist
This commit is contained in:
commit
0ce6fad14e
1 changed files with 4 additions and 6 deletions
|
@ -2,24 +2,22 @@
|
|||
set -e
|
||||
[ -n "$RBENV_DEBUG" ] && set -x
|
||||
|
||||
RBENV_VERSION_NAME="$(rbenv-version-name)"
|
||||
|
||||
if [ "$1" = "--bare" ]; then
|
||||
hit_prefix=""
|
||||
miss_prefix=""
|
||||
print_version="$RBENV_VERSION_NAME"
|
||||
current_version=""
|
||||
else
|
||||
hit_prefix="* "
|
||||
miss_prefix=" "
|
||||
print_version="$(rbenv-version)"
|
||||
current_version="$(rbenv-version-name || true)"
|
||||
fi
|
||||
|
||||
for path in "${RBENV_ROOT}/versions/"*; do
|
||||
if [ -d "$path" ]; then
|
||||
version="${path##*/}"
|
||||
|
||||
if [ "$version" == "$RBENV_VERSION_NAME" ]; then
|
||||
echo "${hit_prefix}${print_version}"
|
||||
if [ "$version" == "$current_version" ]; then
|
||||
echo "${hit_prefix}$(rbenv-version)"
|
||||
else
|
||||
echo "${miss_prefix}${version}"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue