pyenv/libexec/pyenv-version-file-write

21 lines
480 B
Bash
Executable file

#!/usr/bin/env bash
set -e
[ -n "$PYENV_DEBUG" ] && set -x
PYENV_VERSION_FILE="$1"
shift
versions=("$@")
if [ -z "$versions" ] || [ -z "$PYENV_VERSION_FILE" ]; then
echo "usage: pyenv write-version-file FILENAME VERSIONS..." >&2
exit 1
fi
# Make sure the specified version is installed.
pyenv-prefix "${vesions[@]}" >/dev/null
# Write the version out to disk.
rm -f "$PYENV_VERSION_FILE"
for version in "${versions[@]}"; do
echo "$version" >> "$PYENV_VERSION_FILE"
done