mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
feat(pyenv): add option to hide system Python version
Added ZSH_PYENV_NO_SYSTEM option to hide the system or default Python version in the prompt.
This commit is contained in:
parent
0cfe7f081f
commit
d9f9043f30
2 changed files with 9 additions and 0 deletions
|
|
@ -88,11 +88,17 @@ if [[ $FOUND_PYENV -eq 1 ]]; then
|
|||
|
||||
function pyenv_prompt_info() {
|
||||
local version="$(pyenv version-name)"
|
||||
if [[ "$ZSH_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_PYENV_NO_SYSTEM" = "true" ]]; then
|
||||
return
|
||||
fi
|
||||
local version="$(python3 -V 2>&1 | cut -d' ' -f2)"
|
||||
echo "${ZSH_THEME_PYENV_PREFIX=}system: ${version:gs/%/%%}${ZSH_THEME_PYENV_SUFFIX=}"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue