From 355543c4cc2936e915979d9c2b311a7d5079443f Mon Sep 17 00:00:00 2001 From: Joel Kuzmarski Date: Fri, 29 Jul 2016 02:10:28 -0500 Subject: [PATCH] Add pyenv version to python-info --- modules/python/functions/python-info | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/modules/python/functions/python-info b/modules/python/functions/python-info index 6a8c7589..199f4664 100644 --- a/modules/python/functions/python-info +++ b/modules/python/functions/python-info @@ -6,6 +6,9 @@ # Sorin Ionescu # +local version +local version_format +local version_formatted local virtualenv_format local virtualenv_formatted @@ -13,6 +16,17 @@ local virtualenv_formatted unset python_info typeset -gA python_info +if (( $+commands[pyenv] )); then + version="${"$(pyenv version)"%% *}" +fi + +# Format version. +if [[ -n "$version" ]]; then + zstyle -s ':prezto:module:python:info:version' format 'version_format' + zformat -f version_formatted "$version_format" "v:$version" + python_info[version]="${version_formatted}" +fi + # Format virtualenv. if [[ -n "$VIRTUAL_ENV" ]]; then zstyle -s ':prezto:module:python:info:virtualenv' format 'virtualenv_format'