pyenv/libexec/pyenv-global

26 lines
597 B
Bash
Executable file

#!/usr/bin/env bash
set -e
[ -n "$PYENV_DEBUG" ] && set -x
# Provide pyenv completions
if [ "$1" = "--complete" ]; then
echo system
exec pyenv-versions --bare
fi
versions=($@)
PYENV_VERSION_FILE="${PYENV_ROOT}/version"
if [ -n "$versions" ]; then
pyenv-version-file-write "$PYENV_VERSION_FILE" "${versions[@]}"
else
IFS=: versions=($(
pyenv-version-file-read "$PYENV_VERSION_FILE" ||
pyenv-version-file-read "${PYENV_ROOT}/global" ||
pyenv-version-file-read "${PYENV_ROOT}/default" ||
echo system
))
for version in "${versions[@]}"; do
echo "$version"
done
fi