mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
fix versions
in case current version doesn't exist
`rbenv-versions` tries to read the current version to display a marker next to it, but if that fails the whole script aborts. This change makes it so that the failures from `rbenv-version-name` are tolerated. It also makes the `--bare` mode never call it in the first place, because it doesn't need to display a marker.
This commit is contained in:
parent
2a347226df
commit
47c8a0e0b8
1 changed files with 4 additions and 6 deletions
|
@ -2,24 +2,22 @@
|
||||||
set -e
|
set -e
|
||||||
[ -n "$RBENV_DEBUG" ] && set -x
|
[ -n "$RBENV_DEBUG" ] && set -x
|
||||||
|
|
||||||
RBENV_VERSION_NAME="$(rbenv-version-name)"
|
|
||||||
|
|
||||||
if [ "$1" = "--bare" ]; then
|
if [ "$1" = "--bare" ]; then
|
||||||
hit_prefix=""
|
hit_prefix=""
|
||||||
miss_prefix=""
|
miss_prefix=""
|
||||||
print_version="$RBENV_VERSION_NAME"
|
current_version=""
|
||||||
else
|
else
|
||||||
hit_prefix="* "
|
hit_prefix="* "
|
||||||
miss_prefix=" "
|
miss_prefix=" "
|
||||||
print_version="$(rbenv-version)"
|
current_version="$(rbenv-version-name || true)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for path in "${RBENV_ROOT}/versions/"*; do
|
for path in "${RBENV_ROOT}/versions/"*; do
|
||||||
if [ -d "$path" ]; then
|
if [ -d "$path" ]; then
|
||||||
version="${path##*/}"
|
version="${path##*/}"
|
||||||
|
|
||||||
if [ "$version" == "$RBENV_VERSION_NAME" ]; then
|
if [ "$version" == "$current_version" ]; then
|
||||||
echo "${hit_prefix}${print_version}"
|
echo "${hit_prefix}$(rbenv-version)"
|
||||||
else
|
else
|
||||||
echo "${miss_prefix}${version}"
|
echo "${miss_prefix}${version}"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue