2020-05-13 18:03:24 +02:00
|
|
|
# Custom load for direnv
|
|
|
|
# See https://direnv.net/
|
|
|
|
|
|
|
|
if [ -n "$(which direnv 2>/dev/null)" ]; then
|
2020-05-13 18:55:50 +02:00
|
|
|
current_shell=$(ps -p $$ | awk '$1 != "PID" {print $(NF)}')
|
2020-05-13 19:01:57 +02:00
|
|
|
eval "$(direnv hook $current_shell)" || true
|
2020-05-13 18:03:24 +02:00
|
|
|
|
|
|
|
# See https://github.com/direnv/direnv/wiki/Python#restoring-the-ps
|
|
|
|
show_virtual_env() {
|
|
|
|
if [[ -n "$VIRTUAL_ENV" && -n "$DIRENV_DIR" ]]; then
|
|
|
|
echo "($(basename $VIRTUAL_ENV))"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
if [[ -n ${ZSH_VERSION-} ]]; then
|
|
|
|
setopt PROMPT_SUBST
|
|
|
|
else
|
|
|
|
export -f show_virtual_env
|
|
|
|
fi
|
|
|
|
|
|
|
|
PS1='$(show_virtual_env) '$PS1
|
|
|
|
fi
|