mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
33 lines
595 B
Text
33 lines
595 B
Text
|
#!/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
|
||
|
|
||
|
version="$1"
|
||
|
|
||
|
if [ -z "$version" ]; then
|
||
|
if [ -z "$PYENV_VERSION" ]; then
|
||
|
echo "pyenv: no shell-specific version configured" >&2
|
||
|
exit 1
|
||
|
else
|
||
|
echo "echo \"\$PYENV_VERSION\""
|
||
|
exit
|
||
|
fi
|
||
|
fi
|
||
|
|
||
|
if [ "$version" = "--unset" ]; then
|
||
|
echo "unset PYENV_VERSION"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
# Make sure the specified version is installed.
|
||
|
pyenv-prefix "$version" >/dev/null
|
||
|
|
||
|
echo "export PYENV_VERSION=\"${version}\""
|