zsh/plugins/pyenv/pyenv.plugin.zsh

24 lines
584 B
Bash
Raw Permalink Normal View History

2021-02-26 16:25:55 +00:00
export PYENV_ROOT=${XDG_DATA_HOME:-$HOME/.local/share}/pyenv
_init_pyenv() {
2021-06-21 10:12:53 +00:00
unfunction pyenv
2021-12-03 14:09:12 +00:00
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
2021-02-26 16:25:55 +00:00
eval "$(pyenv init -)"
2021-12-03 14:09:12 +00:00
source $(pyenv root)/completions/pyenv.zsh
2021-02-26 16:25:55 +00:00
if pyenv commands | grep -q 'virtualenv'; then
eval "$(pyenv virtualenv-init -)"
fi
}
if [[ -d $PYENV_ROOT ]]; then
2021-06-18 10:10:01 +00:00
pyenv() {
_init_pyenv
pyenv $@
}
2021-02-26 16:25:55 +00:00
else
pyenv() {
echo -n "pyenv is not installed. Install now? [yn] "; read -q || return
git clone https://github.com/pyenv/pyenv.git $PYENV_ROOT
_init_pyenv
}
fi