1
0
mirror of https://github.com/dcarrillo/prezto.git synced 2024-11-20 14:21:12 +00:00
prezto/modules/python/functions/python-info
ickc 96bbb31cc8 Added conda virtualenv support to python module. (#1505)
* Added conda virtualenv support to python module
* Added instructions for Python module options to README

Thanks to @egpbos for the original feature and @ickc for fixing the merge conflicts.
2017-11-12 16:20:52 -08:00

34 lines
911 B
Plaintext

#
# Exposes information about the Python environment via the $python_info
# associative array.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
# Patrick Bos <egpbos@gmail.com>
#
# function python-info {
local virtualenv_format
local virtualenv_formatted
# Clean up previous $python_info.
unset python_info
typeset -gA python_info
# Format virtualenv.
if [[ -n "$VIRTUAL_ENV" ]]; then
zstyle -s ':prezto:module:python:info:virtualenv' format 'virtualenv_format'
zformat -f virtualenv_formatted "$virtualenv_format" "v:${VIRTUAL_ENV:t}"
python_info[virtualenv]="$virtualenv_formatted"
fi
# Do the same for Conda virtual environments
if [[ -n "$CONDA_DEFAULT_ENV" ]]; then
zstyle -s ':prezto:module:python:info:virtualenv' format 'virtualenv_format'
zformat -f virtualenv_formatted "$virtualenv_format" "v:${CONDA_DEFAULT_ENV:t}"
python_info[virtualenv]="$virtualenv_formatted"
fi
# }