mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-12 13:33:45 -05:00
move pyenv-sh-{push,pop} into plugins since they aren't from rbenv
This commit is contained in:
19
plugins/pyenv-version-ext/bin/pyenv-sh-pop
Executable file
19
plugins/pyenv-version-ext/bin/pyenv-sh-pop
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# Usage: pyenv pop <version>
|
||||
set -e
|
||||
[ -n "$PYENV_DEBUG" ] && set -x
|
||||
|
||||
IFS=: versions=($(pyenv-version-name))
|
||||
|
||||
length="${#versions[@]}"
|
||||
PYENV_VERSION_NAMES=()
|
||||
for ((i=0; i<length-1; i++)); do
|
||||
PYENV_VERSION_NAMES=("${PYENV_VERSION_NAMES[@]}" "${versions[$i]}")
|
||||
done
|
||||
|
||||
if [ -n "$PYENV_VERSION" ]; then
|
||||
IFS=: PYENV_VERSION="${PYENV_VERSION_NAMES[*]}"
|
||||
echo "export PYENV_VERSION=\"${PYENV_VERSION}\""
|
||||
else
|
||||
pyenv-version-file-write "$(pyenv-version-file)" "${PYENV_VERSION_NAMES[@]}"
|
||||
fi
|
||||
15
plugins/pyenv-version-ext/bin/pyenv-sh-push
Executable file
15
plugins/pyenv-version-ext/bin/pyenv-sh-push
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Usage: pyenv push <version>
|
||||
set -e
|
||||
[ -n "$PYENV_DEBUG" ] && set -x
|
||||
|
||||
IFS=: PYENV_VERSION_NAMES=($(pyenv-version-name))
|
||||
versions=("$@")
|
||||
PYENV_VERSION_NAMES=("${PYENV_VERSION_NAMES[@]}" "${versions[@]}")
|
||||
|
||||
if [ -n "$PYENV_VERSION" ]; then
|
||||
IFS=: PYENV_VERSION="${PYENV_VERSION_NAMES[*]}"
|
||||
echo "export PYENV_VERSION=\"${PYENV_VERSION}\""
|
||||
else
|
||||
pyenv-version-file-write "$(pyenv-version-file)" "${PYENV_VERSION_NAMES[@]}"
|
||||
fi
|
||||
Reference in New Issue
Block a user