Merge pull request #1849 from tiagobarros99/purity-add-virtualenv
purity theme, added virtualenv name displaypull/1858/head
commit
4860fb8c60
|
|
@ -44,6 +44,7 @@ themes/brainy
|
||||||
themes/brunton
|
themes/brunton
|
||||||
themes/command_duration.theme.bash
|
themes/command_duration.theme.bash
|
||||||
themes/modern
|
themes/modern
|
||||||
|
themes/purity
|
||||||
|
|
||||||
# plugins
|
# plugins
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
# shellcheck shell=bash
|
||||||
|
|
||||||
SCM_THEME_PROMPT_DIRTY=" ${bold_red}⊘${normal}"
|
SCM_THEME_PROMPT_DIRTY=" ${bold_red}⊘${normal}"
|
||||||
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}"
|
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓${normal}"
|
||||||
|
|
@ -14,9 +14,21 @@ STATUS_THEME_PROMPT_BAD="${bold_red}❯${reset_color}${normal} "
|
||||||
STATUS_THEME_PROMPT_OK="${bold_green}❯${reset_color}${normal} "
|
STATUS_THEME_PROMPT_OK="${bold_green}❯${reset_color}${normal} "
|
||||||
PURITY_THEME_PROMPT_COLOR="${PURITY_THEME_PROMPT_COLOR:=$blue}"
|
PURITY_THEME_PROMPT_COLOR="${PURITY_THEME_PROMPT_COLOR:=$blue}"
|
||||||
|
|
||||||
|
venv_prompt() {
|
||||||
|
python_venv=""
|
||||||
|
# Detect python venv
|
||||||
|
if [[ -n "${CONDA_DEFAULT_ENV}" ]]; then
|
||||||
|
python_venv="($PYTHON_VENV_CHAR${CONDA_DEFAULT_ENV}) "
|
||||||
|
elif [[ -n "${VIRTUAL_ENV}" ]]; then
|
||||||
|
python_venv="($PYTHON_VENV_CHAR$(basename "${VIRTUAL_ENV}")) "
|
||||||
|
fi
|
||||||
|
[[ -n "${python_venv}" ]] && echo "${python_venv}"
|
||||||
|
}
|
||||||
|
|
||||||
function prompt_command() {
|
function prompt_command() {
|
||||||
local ret_status="$( [ $? -eq 0 ] && echo -e "$STATUS_THEME_PROMPT_OK" || echo -e "$STATUS_THEME_PROMPT_BAD")"
|
retval=$?
|
||||||
PS1="\n${PURITY_THEME_PROMPT_COLOR}\w $(scm_prompt_info)\n${ret_status} "
|
local ret_status="$([ $retval -eq 0 ] && echo -e "$STATUS_THEME_PROMPT_OK" || echo -e "$STATUS_THEME_PROMPT_BAD")"
|
||||||
|
PS1="\n${PURITY_THEME_PROMPT_COLOR}\w $(scm_prompt_info)\n${ret_status}$(venv_prompt)"
|
||||||
}
|
}
|
||||||
|
|
||||||
safe_append_prompt_command prompt_command
|
safe_append_prompt_command prompt_command
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue