1
0
mirror of https://github.com/robbyrussell/oh-my-zsh.git synced 2025-12-07 16:00:41 +01:00

feat(pyenv): add prompt customization (#12738)

Co-authored-by: Carlo Sala <carlosalag@protonmail.com>
This commit is contained in:
Olivier Mehani
2024-11-20 06:32:01 +11:00
committed by GitHub
parent b5d52682ca
commit 081d704f32
2 changed files with 16 additions and 2 deletions

View File

@@ -88,13 +88,19 @@ if [[ $FOUND_PYENV -eq 1 ]]; then
function pyenv_prompt_info() {
local version="$(pyenv version-name)"
echo "${version:gs/%/%%}"
if [[ "$ZSH_THEME_PYENV_NO_SYSTEM" == "true" ]] && [[ "${version}" == "system" ]]; then
return
fi
echo "${ZSH_THEME_PYENV_PREFIX=}${version:gs/%/%%}${ZSH_THEME_PYENV_SUFFIX=}"
}
else
# Fall back to system python
function pyenv_prompt_info() {
if [[ "$ZSH_THEME_PYENV_NO_SYSTEM" == "true" ]]; then
return
fi
local version="$(python3 -V 2>&1 | cut -d' ' -f2)"
echo "system: ${version:gs/%/%%}"
echo "${ZSH_THEME_PYENV_PREFIX=}system: ${version:gs/%/%%}${ZSH_THEME_PYENV_SUFFIX=}"
}
fi