2012-10-02 23:19:42 -04:00
|
|
|
#!/usr/bin/env bash
|
2013-01-18 03:41:41 -05:00
|
|
|
# Usage: pyenv pop <version>
|
2012-10-02 23:19:42 -04:00
|
|
|
set -e
|
|
|
|
[ -n "$PYENV_DEBUG" ] && set -x
|
|
|
|
|
|
|
|
IFS=: versions=($(pyenv-version-name))
|
|
|
|
|
2013-06-12 23:06:46 -04:00
|
|
|
echo "WARNING: The \`pop' command will be removed from pyenv. Please install https://github.com/yyuu/pyenv-version-ext." 1>&2
|
|
|
|
|
2012-10-02 23:19:42 -04:00
|
|
|
length="${#versions[@]}"
|
|
|
|
PYENV_VERSION_NAMES=()
|
|
|
|
for ((i=0; i<length-1; i++)); do
|
|
|
|
PYENV_VERSION_NAMES=("${PYENV_VERSION_NAMES[@]}" "${versions[$i]}")
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -n "$PYENV_VERSION" ]; then
|
|
|
|
IFS=: PYENV_VERSION="${PYENV_VERSION_NAMES[*]}"
|
|
|
|
echo "export PYENV_VERSION=\"${PYENV_VERSION}\""
|
|
|
|
else
|
|
|
|
pyenv-version-file-write "$(pyenv-version-file)" "${PYENV_VERSION_NAMES[@]}"
|
|
|
|
fi
|