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

set P9K_PYENV_PYTHON_VERSION in prompt_pyenv; see #679

This commit is contained in:
romkatv 2020-05-02 14:32:17 +02:00
parent 459af1f238
commit fdb0bb6af7

View file

@ -4038,6 +4038,8 @@ function _p9k_pyenv_global_version() {
# Segment to display pyenv information
# https://github.com/pyenv/pyenv#choosing-the-python-version
prompt_pyenv() {
unset P9K_PYENV_PYTHON_VERSION
local v=${(j.:.)${(@)${(s.:.)PYENV_VERSION}#python-}}
if [[ -n $v ]]; then
(( ${_POWERLEVEL9K_PYENV_SOURCES[(I)shell]} )) || return
@ -4084,6 +4086,14 @@ prompt_pyenv() {
[[ $v == system ]] && return
fi
local versions=${PYENV_ROOT:-$HOME/.pyenv}/versions
versions=${versions:A}
local version=$versions/$v
version=${version:A}
if [[ $version == (#b)$versions/([^/]##)* ]]; then
typeset -g P9K_PYENV_PYTHON_VERSION=$match[1]
fi
_p9k_prompt_segment "$0" "blue" "$_p9k_color1" 'PYTHON_ICON' 0 '' "${v//\%/%%}"
}