mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-14 20:39:55 -05:00
Add --bare option to pyenv version
It just points at pyenv version-name. This adds consistency with the behavior of `pyenv versions --bare`
This commit is contained in:
parent
6e79eb0b7c
commit
7f47b3121f
1 changed files with 21 additions and 3 deletions
|
@ -1,9 +1,10 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Summary: Show the current Python version(s) and its origin
|
# Summary: Show the current Python version(s) and its origin
|
||||||
|
# Usage: pyenv version [--bare]
|
||||||
#
|
#
|
||||||
# Shows the currently selected Python version(s) and how it was
|
# Shows the currently selected Python version(s) and how it was
|
||||||
# selected. To obtain only the version string, use `pyenv
|
# selected. To obtain only the version string, use `pyenv version
|
||||||
# version-name'.
|
# --bare` or `pyenv version-name'.
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
[ -n "$PYENV_DEBUG" ] && set -x
|
[ -n "$PYENV_DEBUG" ] && set -x
|
||||||
|
@ -13,8 +14,25 @@ OLDIFS="$IFS"
|
||||||
IFS=: PYENV_VERSION_NAMES=($(pyenv-version-name)) || exitcode=$?
|
IFS=: PYENV_VERSION_NAMES=($(pyenv-version-name)) || exitcode=$?
|
||||||
IFS="$OLDIFS"
|
IFS="$OLDIFS"
|
||||||
|
|
||||||
|
unset bare
|
||||||
|
for arg; do
|
||||||
|
case "$arg" in
|
||||||
|
--complete )
|
||||||
|
echo --bare
|
||||||
|
exit ;;
|
||||||
|
--bare ) bare=1 ;;
|
||||||
|
* )
|
||||||
|
pyenv-help --usage version >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
for PYENV_VERSION_NAME in "${PYENV_VERSION_NAMES[@]}"; do
|
for PYENV_VERSION_NAME in "${PYENV_VERSION_NAMES[@]}"; do
|
||||||
|
if [[ -n $bare ]]; then
|
||||||
|
echo "$PYENV_VERSION_NAME"
|
||||||
|
else
|
||||||
echo "$PYENV_VERSION_NAME (set by $(pyenv-version-origin))"
|
echo "$PYENV_VERSION_NAME (set by $(pyenv-version-origin))"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
exit $exitcode
|
exit $exitcode
|
||||||
|
|
Loading…
Reference in a new issue