Skip to content

Commit 78fcab8

Browse files
committed
Added better conditionals for getting venv prompt
1 parent cb6b921 commit 78fcab8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

theme.bash

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function __powerline_python_virtual_env_prompt {
8989
local color=${VIRTUAL_ENV_PROMPT_COLOR}
9090
local venv_info=""
9191
if [[ "$venv_path" != "" ]]; then
92-
92+
venv_info=$(basename $venv_path)
9393
if [[ -f "venv/pyvenv.cfg" ]]; then
9494
shopt -s extglob
9595
configfile="venv/pyvenv.cfg" # set the actual path name of your (DOS or Unix) config file
@@ -105,13 +105,15 @@ function __powerline_python_virtual_env_prompt {
105105
fi
106106
fi
107107
done < $configfile
108-
eval prompt=$prompt
109-
venv_info="$prompt"
108+
if [[ -v prompt ]]; then
109+
eval prompt=$prompt
110+
venv_info="$prompt"
111+
fi
110112
else
111113
venv_info=$(basename ${venv_path})
112114
fi
113115
fi
114-
[[ -n "${venv_info}" ]] && echo "${venv_info}|${color}"
116+
[[ -n "${venv_info}" ]] && echo "${PADDING}(${venv_info})${PADDING}|${color}"
115117
}
116118

117119
function __powerline_user_info_prompt {

0 commit comments

Comments
 (0)