make autopyenv PS1 prettier
This commit is contained in:
parent
bede9bf15a
commit
7a6813d980
|
@ -1,16 +1,21 @@
|
||||||
PYENV_DIR="${PYENVS_HOME:-${XDG_DATA_HOME:-$HOME/.local/share}/virtualenv}"
|
PYENV_DIR="${PYENVS_HOME:-${XDG_DATA_HOME:-$HOME/.local/share}/virtualenv}"
|
||||||
function chpwd_activate(){
|
function chpwd_activate(){
|
||||||
[[ "$(pwd)" == "/" ]] && return 0
|
[[ "$(pwd)" == "/" ]] && return 0
|
||||||
envdir=$(pwd|sed -e s@/@_@g|cut -c2-)
|
|
||||||
for pydir in $(ls $PYENV_DIR); do
|
for pydir in $(ls $PYENV_DIR); do
|
||||||
if [[ "$envdir" == "$pydir" ]]; then
|
if [[ "$(pwd|sed -e s@/@_@g|cut -c2-)" =~ "^$pydir$" ]]; then
|
||||||
if [ "x$VIRTUAL_ENV" != "x$PYENV_DIR/$pydir" ]; then
|
if [ "x$VIRTUAL_ENV" != "x$PYENV_DIR/$pydir" ]; then
|
||||||
|
export VIRTUAL_ENV_DISABLE_PROMPT=1
|
||||||
|
export PS1=" $PS1"
|
||||||
source "$PYENV_DIR/$pydir/bin/activate"
|
source "$PYENV_DIR/$pydir/bin/activate"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
[[ "x$VIRTUAL_ENV" != "x" ]] && deactivate
|
if [ "x$VIRTUAL_ENV" != "x" ]; then
|
||||||
|
unset VIRTUAL_ENV_DISABLE_PROMPT
|
||||||
|
export PS1="${PS1:3}"
|
||||||
|
deactivate
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function venv-here(){
|
function venv-here(){
|
||||||
|
|
Loading…
Reference in New Issue