1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-24 05:00:07 +00:00

virtualenv: Handle not being in a virtualenv

Pre-Poetry support, we only entered this codepath when we were inside a
virtualenv. Now we enter it for every directory, but we don't want to
display an empty segment for non-virtualenv locations.
This commit is contained in:
Alex Jurkiewicz 2023-10-12 14:38:08 +08:00
parent 7e835be2d8
commit f2772bd56f

View file

@ -4320,6 +4320,10 @@ prompt_virtualenv() {
_virtualenv_load_name_poetry $idx _virtualenv_load_name_poetry $idx
fi fi
fi fi
# Display nothing if there's no active virtualenv
if [[ -z $_virtualenv_name ]]; then
return
fi
msg+="$_POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER${_virtualenv_name//\%/%%}$_POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER" msg+="$_POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER${_virtualenv_name//\%/%%}$_POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER"
case $_POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV in case $_POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV in
false) false)