Parcourir la source

Merge pull request #1829 from anton-petrov/master

Added --nosystem argument
pull/1786/head
Anton Petrov il y a 3 ans
committed by GitHub
Parent
révision
3fbbc155c7
Aucune clé connue n'a été trouvée dans la base pour cette signature ID de la clé GPG: 4AEE18F83AFDEB23
1 fichiers modifiés avec 10 ajouts et 2 suppressions
  1. +10
    -2
      libexec/pyenv-which

+ 10
- 2
libexec/pyenv-which Voir le fichier

@ -2,10 +2,12 @@
#
# 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
# you run the given command.
# Use --nosystem argument in case when you don't need to search command in the
# system environment.
#
set -e
@ -16,6 +18,12 @@ if [ "$1" = "--complete" ]; then
exec pyenv-shims --short
fi
if [ "$2" = "--nosystem" ]; then
system=""
else
system="system"
fi
remove_from_path() {
local path_to_remove="$1"
local path_before
@ -39,7 +47,7 @@ OLDIFS="$IFS"
IFS=: versions=(${PYENV_VERSION:-$(pyenv-version-name)})
IFS="$OLDIFS"
for version in "${versions[@]}" "system"; do
for version in "${versions[@]}" "$system"; do
if [ "$version" = "system" ]; then
PATH="$(remove_from_path "${PYENV_ROOT}/shims")"
PYENV_COMMAND_PATH="$(command -v "$PYENV_COMMAND" || true)"

Chargement…
Annuler
Enregistrer