diff options
author | Ben Hilburn <bhilburn@gmail.com> | 2016-06-14 05:10:22 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-14 05:10:22 +0300 |
commit | af825c7cf40d43fe36b68660057ff2420d94fb4b (patch) | |
tree | 13cbe03ad1d9d59326ee9acaf1e9763a34e03f7f /powerlevel9k.zsh-theme | |
parent | 41888bf2a96e13a33db696c51963986472c9d91f (diff) | |
parent | 99429ab26818d539418ac6345679d38f18b32faf (diff) |
Merge pull request #261 from wadkar/pyenv
Add pyenv segment to show active non-system python version
Diffstat (limited to 'powerlevel9k.zsh-theme')
-rwxr-xr-x | powerlevel9k.zsh-theme | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 4206bf51..080c9df1 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -935,6 +935,22 @@ prompt_virtualenv() { fi } +# pyenv: current active python version (with restrictions) +# More information on pyenv (Python version manager like rbenv and rvm): +# https://github.com/yyuu/pyenv +# the prompt parses output of pyenv version and only displays the first word +prompt_pyenv() { + local pyenv_version="$(pyenv version 2>/dev/null)" + pyenv_version="${pyenv_version%% *}" + # XXX: The following should return the same as above. + # This reads better for devs familiar with sed/awk/grep/cut utilities + # Using shell expansion/substitution may hamper future maintainability + #local pyenv_version="$(pyenv version 2>/dev/null | head -n1 | cut -d' ' -f1)" + if [[ -n "$pyenv_version" && "$pyenv_version" != "system" ]]; then + "$1_prompt_segment" "$0" "$2" "blue" "$DEFAULT_COLOR" "$pyenv_version" 'PYTHON_ICON' + fi +} + ################################################################ # Prompt processing and drawing ################################################################ |