refactor: use elif when checking for -m pip in command to be

executed.

This is a logical change. If the command is `pip install ...`, then you
don't need to look for `python -m pip install ...` in the same command.
Either you have `pip install ...` or `python -m pip install ...`
or something completely different.
This commit is contained in:
Christian Fredrik Johnsen 2024-12-28 12:47:53 +01:00
parent 6112062fdd
commit 4017615af3

View File

@ -4,10 +4,9 @@ PYENV_REHASH_COMMAND="${PYENV_COMMAND##*/}"
# Remove any version information, from e.g. "pip2" or "pip3.4". # Remove any version information, from e.g. "pip2" or "pip3.4".
if [[ $PYENV_REHASH_COMMAND =~ ^(pip|easy_install)[23](\.[0-9]+)?$ ]]; then if [[ $PYENV_REHASH_COMMAND =~ ^(pip|easy_install)[23](\.[0-9]+)?$ ]]; then
PYENV_REHASH_COMMAND="${BASH_REMATCH[1]}" PYENV_REHASH_COMMAND="${BASH_REMATCH[1]}"
fi
# Check for ` -m pip ` in arguments # Check for ` -m pip ` in arguments
if [[ "$*" =~ [[:space:]]-m[[:space:]]pip[[:space:]] ]]; then elif [[ "$*" =~ [[:space:]]-m[[:space:]]pip[[:space:]] ]]; then
PYENV_REHASH_COMMAND="pip" PYENV_REHASH_COMMAND="pip"
fi fi