pyenv/libexec/pyenv-sh-shell

34 lines
649 B
Text
Raw Normal View History

#!/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
versions=("$@")
if [ -z "$versions" ]; 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 [ "$versions" = "--unset" ]; then
echo "unset PYENV_VERSION"
exit 1
fi
# Make sure the specified version is installed.
pyenv-prefix "${versions[@]}" >/dev/null
IFS=: PYENV_VERSION="${versions[*]}"
echo "export PYENV_VERSION=\"${PYENV_VERSION}\""