2012-08-31 02:23:41 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
[ -n "$PYENV_DEBUG" ] && set -x
|
|
|
|
|
|
|
|
# Provide pyenv completions
|
|
|
|
if [ "$1" = "--complete" ]; then
|
|
|
|
echo --unset
|
|
|
|
echo system
|
|
|
|
exec pyenv-versions --bare
|
|
|
|
fi
|
|
|
|
|
2012-08-31 07:12:26 -04:00
|
|
|
version="$1"
|
2012-08-31 02:23:41 -04:00
|
|
|
|
2012-08-31 07:12:26 -04:00
|
|
|
if [ -z "$version" ]; then
|
2012-08-31 06:39:29 -04:00
|
|
|
if [ -z "$PYENV_VERSION" ]; then
|
2012-08-31 02:23:41 -04:00
|
|
|
echo "pyenv: no shell-specific version configured" >&2
|
|
|
|
exit 1
|
|
|
|
else
|
2012-08-31 07:12:26 -04:00
|
|
|
echo "echo \"\$PYENV_VERSION\""
|
2012-08-31 02:23:41 -04:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2012-08-31 07:12:26 -04:00
|
|
|
if [ "$version" = "--unset" ]; then
|
2012-08-31 06:39:29 -04:00
|
|
|
echo "unset PYENV_VERSION"
|
2012-08-31 02:23:41 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Make sure the specified version is installed.
|
2012-08-31 07:12:26 -04:00
|
|
|
pyenv-prefix $version >/dev/null
|
2012-08-31 02:23:41 -04:00
|
|
|
|
2012-08-31 07:12:26 -04:00
|
|
|
echo "export PYENV_VERSION=\"${version}\""
|