File: pyenv-version

package info (click to toggle)
pyenv 2.6.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,496 kB
  • sloc: sh: 4,914; python: 410; makefile: 161; ansic: 60
file content (36 lines) | stat: -rwxr-xr-x 785 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
# Summary: Show the current Python version(s) and its origin
# Usage: pyenv version [--bare]
#
#     --bare    show just the version name. An alias to `pyenv version-name'

set -e
[ -n "$PYENV_DEBUG" ] && set -x

exitcode=0
OLDIFS="$IFS"
IFS=: PYENV_VERSION_NAMES=($(pyenv-version-name)) || exitcode=$?
IFS="$OLDIFS"

unset bare
for arg; do
    case "$arg" in
        --complete )
            echo --bare
            exit ;;
        --bare ) bare=1 ;;
        * )
          pyenv-help --usage version >&2
          exit 1
          ;;
    esac
done
for PYENV_VERSION_NAME in "${PYENV_VERSION_NAMES[@]}"; do
  if [[ -n $bare ]]; then
      echo "$PYENV_VERSION_NAME"
  else
      echo "$PYENV_VERSION_NAME (set by $(pyenv-version-origin))"
  fi
done

exit $exitcode