Adding Pyenv support to Python virtualenv as "fallback"

This commit is contained in:
Viktor (Icon) VAD
2015-09-20 10:39:33 +01:00
parent 0adeb1c9d8
commit 3bfb593250
2 changed files with 7 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ theme based on the
simplicity, showing information only when it's relevant. simplicity, showing information only when it's relevant.
It currently shows: It currently shows:
- Current Python virtualenv - Current Python virtualenv; when using Pyenv and no active virtualenv shows the current Python version the shell uses
- Current Ruby version using Rbenv; version and gemset when on RVM - Current Ruby version using Rbenv; version and gemset when on RVM
- Current Node.js version, through NVM - Current Node.js version, through NVM
- Git status - Git status
@@ -136,7 +136,7 @@ or don't want to see. All options must be overridden in your **.zshrc** file.
|`BULLETTRAIN_CONTEXT_DEFAULT_USER`|none|Default user. If you are running with other user other than default, the segment will be showed. |`BULLETTRAIN_CONTEXT_DEFAULT_USER`|none|Default user. If you are running with other user other than default, the segment will be showed.
|`BULLETTRAIN_IS_SSH_CLIENT`|none|If `true`, the segment will be showed. |`BULLETTRAIN_IS_SSH_CLIENT`|none|If `true`, the segment will be showed.
### Python virtualenv ### Python virtualenv (+Pyenv)
|Variable|Default|Meaning |Variable|Default|Meaning
|--------|-------|-------| |--------|-------|-------|

View File

@@ -361,6 +361,8 @@ prompt_virtualenv() {
local virtualenv_path="$VIRTUAL_ENV" local virtualenv_path="$VIRTUAL_ENV"
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
prompt_segment $BULLETTRAIN_VIRTUALENV_BG $BULLETTRAIN_VIRTUALENV_FG $BULLETTRAIN_VIRTUALENV_PREFIX" $(basename $virtualenv_path)" prompt_segment $BULLETTRAIN_VIRTUALENV_BG $BULLETTRAIN_VIRTUALENV_FG $BULLETTRAIN_VIRTUALENV_PREFIX" $(basename $virtualenv_path)"
elif which pyenv &> /dev/null; then
prompt_segment $BULLETTRAIN_VIRTUALENV_BG $BULLETTRAIN_VIRTUALENV_FG $BULLETTRAIN_VIRTUALENV_PREFIX" $(pyenv version | sed -e 's/ (set.*$//')"
fi fi
} }