2011-08-12 05:33:45 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2011-08-01 16:56:52 -04:00
|
|
|
|
2011-08-09 16:41:35 -04:00
|
|
|
RBENV_VERSION_NAME="$(rbenv-version-name)"
|
2011-08-03 00:19:37 -04:00
|
|
|
|
|
|
|
if [ "$1" = "--bare" ]; then
|
|
|
|
hit_prefix=""
|
|
|
|
miss_prefix=""
|
2011-08-09 16:41:35 -04:00
|
|
|
print_version="$RBENV_VERSION_NAME"
|
|
|
|
else
|
|
|
|
hit_prefix="* "
|
|
|
|
miss_prefix=" "
|
|
|
|
print_version="$(rbenv-version)"
|
2011-08-03 00:19:37 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
for path in "${HOME}/.rbenv/versions/"*; do
|
2011-08-01 16:50:26 -04:00
|
|
|
if [ -d "$path" ]; then
|
|
|
|
version="${path##*/}"
|
|
|
|
|
2011-08-09 16:41:35 -04:00
|
|
|
if [ "$version" == "$RBENV_VERSION_NAME" ]; then
|
|
|
|
echo "${hit_prefix}${print_version}"
|
2011-08-01 16:50:26 -04:00
|
|
|
else
|
2011-08-03 00:19:37 -04:00
|
|
|
echo "${miss_prefix}${version}"
|
2011-08-01 16:50:26 -04:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|