mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-21 20:00:07 +00:00
Merge branch 'mickolka-feature/virtualenv-custom-prompt'
This commit is contained in:
commit
ecf91710c0
1 changed files with 29 additions and 0 deletions
|
@ -4254,6 +4254,26 @@ function instant_prompt_chezmoi_shell() {
|
||||||
_p9k_prompt_segment prompt_chezmoi_shell blue $_p9k_color1 CHEZMOI_ICON 1 '$CHEZMOI_ICON' ''
|
_p9k_prompt_segment prompt_chezmoi_shell blue $_p9k_color1 CHEZMOI_ICON 1 '$CHEZMOI_ICON' ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _p9k_parse_virtualenv_cfg() {
|
||||||
|
local cfg=$1
|
||||||
|
echo $cfg
|
||||||
|
typeset -g reply
|
||||||
|
[[ -f $cfg && -r $cfg ]] || return
|
||||||
|
|
||||||
|
local -a lines
|
||||||
|
lines=(${(f)"$(<$cfg)"}) || return
|
||||||
|
|
||||||
|
local line prompt
|
||||||
|
local -a match mbegin mend
|
||||||
|
for line in $lines; do
|
||||||
|
if [[ $line =~ 'prompt = (.*)' ]]; then
|
||||||
|
prompt=$match[1]
|
||||||
|
eval "reply=$prompt"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
# Virtualenv: current working virtualenv
|
# Virtualenv: current working virtualenv
|
||||||
# More information on virtualenv (Python):
|
# More information on virtualenv (Python):
|
||||||
|
@ -4269,6 +4289,15 @@ prompt_virtualenv() {
|
||||||
elif [[ $v == $~_POWERLEVEL9K_VIRTUALENV_GENERIC_NAMES ]]; then
|
elif [[ $v == $~_POWERLEVEL9K_VIRTUALENV_GENERIC_NAMES ]]; then
|
||||||
v=${VIRTUAL_ENV:h:t}
|
v=${VIRTUAL_ENV:h:t}
|
||||||
fi
|
fi
|
||||||
|
local cfg="$VIRTUAL_ENV/pyvenv.cfg"
|
||||||
|
if ! _p9k_cache_stat_get $0 $cfg; then
|
||||||
|
local -a reply
|
||||||
|
_p9k_parse_virtualenv_cfg $cfg
|
||||||
|
_p9k_cache_stat_set $reply
|
||||||
|
fi
|
||||||
|
if [[ -n $_p9k__cache_val[1] ]]; then
|
||||||
|
v=$_p9k__cache_val[1]
|
||||||
|
fi
|
||||||
msg+="$_POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER${v//\%/%%}$_POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER"
|
msg+="$_POWERLEVEL9K_VIRTUALENV_LEFT_DELIMITER${v//\%/%%}$_POWERLEVEL9K_VIRTUALENV_RIGHT_DELIMITER"
|
||||||
case $_POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV in
|
case $_POWERLEVEL9K_VIRTUALENV_SHOW_WITH_PYENV in
|
||||||
false)
|
false)
|
||||||
|
|
Loading…
Reference in a new issue