You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 regels
511 B

  1. #!/usr/bin/env bash
  2. # Usage: pyenv version-file-write <file> <version>
  3. set -e
  4. [ -n "$PYENV_DEBUG" ] && set -x
  5. PYENV_VERSION_FILE="$1"
  6. shift
  7. versions=("$@")
  8. if [ -z "$versions" ] || [ -z "$PYENV_VERSION_FILE" ]; then
  9. pyenv-help --usage version-file-write >&2
  10. exit 1
  11. fi
  12. # Make sure the specified version is installed.
  13. pyenv-prefix "${versions[@]}" >/dev/null
  14. # Write the version out to disk.
  15. rm -f "$PYENV_VERSION_FILE"
  16. for version in "${versions[@]}"; do
  17. echo "$version" >> "$PYENV_VERSION_FILE"
  18. done