mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Merge pull request #1829 from anton-petrov/master
Added --nosystem argument
This commit is contained in:
commit
3fbbc155c7
1 changed files with 10 additions and 2 deletions
|
@ -2,10 +2,12 @@
|
||||||
#
|
#
|
||||||
# Summary: Display the full path to an executable
|
# Summary: Display the full path to an executable
|
||||||
#
|
#
|
||||||
# Usage: pyenv which <command>
|
# Usage: pyenv which <command> [--nosystem]
|
||||||
#
|
#
|
||||||
# Displays the full path to the executable that pyenv will invoke when
|
# Displays the full path to the executable that pyenv will invoke when
|
||||||
# you run the given command.
|
# you run the given command.
|
||||||
|
# Use --nosystem argument in case when you don't need to search command in the
|
||||||
|
# system environment.
|
||||||
#
|
#
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
@ -16,6 +18,12 @@ if [ "$1" = "--complete" ]; then
|
||||||
exec pyenv-shims --short
|
exec pyenv-shims --short
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$2" = "--nosystem" ]; then
|
||||||
|
system=""
|
||||||
|
else
|
||||||
|
system="system"
|
||||||
|
fi
|
||||||
|
|
||||||
remove_from_path() {
|
remove_from_path() {
|
||||||
local path_to_remove="$1"
|
local path_to_remove="$1"
|
||||||
local path_before
|
local path_before
|
||||||
|
@ -39,7 +47,7 @@ OLDIFS="$IFS"
|
||||||
IFS=: versions=(${PYENV_VERSION:-$(pyenv-version-name)})
|
IFS=: versions=(${PYENV_VERSION:-$(pyenv-version-name)})
|
||||||
IFS="$OLDIFS"
|
IFS="$OLDIFS"
|
||||||
|
|
||||||
for version in "${versions[@]}" "system"; do
|
for version in "${versions[@]}" "$system"; do
|
||||||
if [ "$version" = "system" ]; then
|
if [ "$version" = "system" ]; then
|
||||||
PATH="$(remove_from_path "${PYENV_ROOT}/shims")"
|
PATH="$(remove_from_path "${PYENV_ROOT}/shims")"
|
||||||
PYENV_COMMAND_PATH="$(command -v "$PYENV_COMMAND" || true)"
|
PYENV_COMMAND_PATH="$(command -v "$PYENV_COMMAND" || true)"
|
||||||
|
|
Loading…
Reference in a new issue