Skip to content

Commit

Permalink
🐛 Fix Python virtual environment
Browse files Browse the repository at this point in the history
Fix Python virtual environment when in a git repository path.
  • Loading branch information
diogocavilha committed Jun 21, 2019
1 parent 0ce2205 commit 0798a3f
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 61 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Fancy Git Changelog

### v6.0.1

- Fix Python virtual environment when in a git repository path.

### v6.0.0

- Add Python virtual environment support.
Expand Down
19 changes: 9 additions & 10 deletions prompt_styles/dark-double-line.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fancygit_prompt_builder() {
path_end="${none}${bold_none}"
branch="${s_darkgray_bgwhite}${bg_white}${black}${bold}"
branch_end="${bg_none}${none}${bold_none}${s_white}"
local venv=""

# Building prompt
if [ "$branch_status" != "" ]
Expand Down Expand Up @@ -71,23 +72,21 @@ fancygit_prompt_builder() {
branch_name="${branch_name}*"
fi

if [ "$branch_name" != "" ]
then
prompt_path="${path_git}${has_unpushed_commits}${has_git_stash}${has_untracked_files}${has_changed_files}${has_added_files} \\w ${path_end}"
prompt_branch="${branch} ${branch_icon} ${branch_name} ${branch_end}"
PS1="${prompt_user}${prompt_path}${prompt_branch}${prompt_symbol} "
return
fi

local venv=""

if ! [ -z ${VIRTUAL_ENV} ]
then
prompt_user="${user_at_host} \\u@\\h ${user_at_host_end}"
venv="`basename \"$VIRTUAL_ENV\"`"
venv="${bg_dark_gray}${bold}${white}${venv} ${path_end}${s_darkgray_bgdarkgray01}"
fi

if [ "$branch_name" != "" ]
then
prompt_path="${path_git}${has_unpushed_commits}${has_git_stash}${has_untracked_files}${has_changed_files}${has_added_files} \\w ${path_end}"
prompt_branch="${branch} ${branch_icon} ${branch_name} ${branch_end}"
PS1="${venv}${prompt_user}${prompt_path}${prompt_branch}${prompt_symbol} "
return
fi

PS1="${venv}${prompt_user}${prompt_path}${prompt_symbol} "
}

Expand Down
19 changes: 9 additions & 10 deletions prompt_styles/dark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fancygit_prompt_builder() {
path_end="${none}${bold_none}"
branch="${s_darkgray01_bgwhite}${bg_white}${black}${bold}"
branch_end="${bg_none}${none}${bold_none}${s_white}"
local venv=""

# Building prompt
if [ "$branch_status" != "" ]
Expand Down Expand Up @@ -71,23 +72,21 @@ fancygit_prompt_builder() {
branch_name="${branch_name}*"
fi

if [ "$branch_name" != "" ]
then
prompt_path="${path_git}${has_unpushed_commits}${has_git_stash}${has_untracked_files}${has_changed_files}${has_added_files} \\w ${path_end}"
prompt_branch="${branch} ${branch_icon} ${branch_name} ${branch_end}"
PS1="${prompt_user}${prompt_symbol}${prompt_path}${prompt_branch} "
return
fi

local venv=""

if ! [ -z ${VIRTUAL_ENV} ]
then
prompt_user="${user_at_host} \\u@\\h ${user_at_host_end}"
venv="`basename \"$VIRTUAL_ENV\"`"
venv="${bg_dark_gray}${bold}${white}${venv} ${path_end}${s_darkgray_bgdarkgray01}"
fi

if [ "$branch_name" != "" ]
then
prompt_path="${path_git}${has_unpushed_commits}${has_git_stash}${has_untracked_files}${has_changed_files}${has_added_files} \\w ${path_end}"
prompt_branch="${branch} ${branch_icon} ${branch_name} ${branch_end}"
PS1="${venv}${prompt_user}${prompt_symbol}${prompt_path}${prompt_branch} "
return
fi

PS1="${venv}${prompt_user}${prompt_symbol}${prompt_path} "
}

Expand Down
19 changes: 9 additions & 10 deletions prompt_styles/default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fancygit_prompt_builder() {
user_symbol_end="${none}${bold_none}${bg_none}${s_lightmagenta_bgblue}"
branch="${s_blue_bgwhite}${bg_white}${black}${bold}"
branch_end="${bg_none}${none}${bold_none}${s_white}"
local venv=""

# Building prompt
if [ "$branch_status" != "" ]
Expand Down Expand Up @@ -71,23 +72,21 @@ fancygit_prompt_builder() {
branch_name="${branch_name}*"
fi

if [ "$branch_name" != "" ]
then
prompt_path="${path_git}${has_unpushed_commits}${has_git_stash}${has_untracked_files}${has_changed_files}${has_added_files} \\w ${path_end}"
prompt_branch="${branch} ${branch_icon} ${branch_name} ${branch_end}"
PS1="${prompt_user}${prompt_symbol}${prompt_path}${prompt_branch} "
return
fi

local venv=""

if ! [ -z ${VIRTUAL_ENV} ]
then
prompt_user="${user_at_host} \\u@\\h ${user_at_host_end}"
venv="`basename \"$VIRTUAL_ENV\"`"
venv="${bg_light_magenta}${bold}${white}${venv} ${path_end}${s_lightmagenta_bgdarkgray}"
fi

if [ "$branch_name" != "" ]
then
prompt_path="${path_git}${has_unpushed_commits}${has_git_stash}${has_untracked_files}${has_changed_files}${has_added_files} \\w ${path_end}"
prompt_branch="${branch} ${branch_icon} ${branch_name} ${branch_end}"
PS1="${venv}${prompt_user}${prompt_symbol}${prompt_path}${prompt_branch} "
return
fi

PS1="${venv}${prompt_user}${prompt_symbol}${prompt_path} "
}

Expand Down
19 changes: 9 additions & 10 deletions prompt_styles/fancy-double-line.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fancygit_prompt_builder() {
user_symbol_end="${none}${bold_none}${bg_none}${s_dark_gray_bgnone}"
branch="${s_blue_bgwhite}${bg_white}${black}${bold}"
branch_end="${bg_none}${none}${bold_none}${s_white}"
local venv=""

# Building prompt
if [ "$branch_status" != "" ]
Expand Down Expand Up @@ -71,23 +72,21 @@ fancygit_prompt_builder() {
branch_name="${branch_name}*"
fi

if [ "$branch_name" != "" ]
then
prompt_path="${path_git}${has_unpushed_commits}${has_git_stash}${has_untracked_files}${has_changed_files}${has_added_files} \\w ${path_end}"
prompt_branch="${branch} ${branch_icon} ${branch_name} ${branch_end}"
PS1="${prompt_user}${prompt_path}${prompt_branch}${prompt_symbol} "
return
fi

local venv=""

if ! [ -z ${VIRTUAL_ENV} ]
then
prompt_user="${user_at_host} \\u@\\h ${user_at_host_end}"
venv="`basename \"$VIRTUAL_ENV\"`"
venv="${bg_light_magenta}${bold}${white}${venv} ${path_end}${s_lightmagenta_bgdarkgray}"
fi

if [ "$branch_name" != "" ]
then
prompt_path="${path_git}${has_unpushed_commits}${has_git_stash}${has_untracked_files}${has_changed_files}${has_added_files} \\w ${path_end}"
prompt_branch="${branch} ${branch_icon} ${branch_name} ${branch_end}"
PS1="${venv}${prompt_user}${prompt_path}${prompt_branch}${prompt_symbol} "
return
fi

PS1="${venv}${prompt_user}${prompt_path}${prompt_symbol} "
}

Expand Down
19 changes: 9 additions & 10 deletions prompt_styles/light-double-line.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fancygit_prompt_builder() {
path_end="${none}${bold_none}"
branch="${s_lightgray_bgwhite}${bg_white}${black}${bold}"
branch_end="${bg_none}${none}${bold_none}${s_white}"
local venv=""

# Building prompt
if [ "$branch_status" != "" ]
Expand Down Expand Up @@ -71,23 +72,21 @@ fancygit_prompt_builder() {
branch_name="${branch_name}*"
fi

if [ "$branch_name" != "" ]
then
prompt_path="${path_git}${has_unpushed_commits}${has_git_stash}${has_untracked_files}${has_changed_files}${has_added_files} \\w ${path_end}"
prompt_branch="${branch} ${branch_icon} ${branch_name} ${branch_end}"
PS1="${prompt_user}${prompt_path}${prompt_branch}${prompt_symbol} "
return
fi

local venv=""

if ! [ -z ${VIRTUAL_ENV} ]
then
prompt_user="${user_at_host} \\u@\\h ${user_at_host_end}"
venv="`basename \"$VIRTUAL_ENV\"`"
venv="${bg_light_gray}${bold}${black}${venv} ${path_end}${s_lightgray_bgwhite}"
fi

if [ "$branch_name" != "" ]
then
prompt_path="${path_git}${has_unpushed_commits}${has_git_stash}${has_untracked_files}${has_changed_files}${has_added_files} \\w ${path_end}"
prompt_branch="${branch} ${branch_icon} ${branch_name} ${branch_end}"
PS1="${venv}${prompt_user}${prompt_path}${prompt_branch}${prompt_symbol} "
return
fi

PS1="${venv}${prompt_user}${prompt_path}${prompt_symbol} "
}

Expand Down
19 changes: 9 additions & 10 deletions prompt_styles/light.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ fancygit_prompt_builder() {
path_end="${none}${bold_none}"
branch="${s_lightgray_bgwhite}${bg_white}${black}${bold}"
branch_end="${bg_none}${none}${bold_none}${s_white}"
local venv=""

# Building prompt
if [ "$branch_status" != "" ]
Expand Down Expand Up @@ -71,23 +72,21 @@ fancygit_prompt_builder() {
branch_name="${branch_name}*"
fi

if [ "$branch_name" != "" ]
then
prompt_path="${path_git}${has_unpushed_commits}${has_git_stash}${has_untracked_files}${has_changed_files}${has_added_files} \\w ${path_end}"
prompt_branch="${branch} ${branch_icon} ${branch_name} ${branch_end}"
PS1="${prompt_user}${prompt_symbol}${prompt_path}${prompt_branch} "
return
fi

local venv=""

if ! [ -z ${VIRTUAL_ENV} ]
then
prompt_user="${user_at_host} \\u@\\h ${user_at_host_end}"
venv="`basename \"$VIRTUAL_ENV\"`"
venv="${bg_white}${bold}${black}${venv} ${path_end}${s_white_bglightgray}"
fi

if [ "$branch_name" != "" ]
then
prompt_path="${path_git}${has_unpushed_commits}${has_git_stash}${has_untracked_files}${has_changed_files}${has_added_files} \\w ${path_end}"
prompt_branch="${branch} ${branch_icon} ${branch_name} ${branch_end}"
PS1="${venv}${prompt_user}${prompt_symbol}${prompt_path}${prompt_branch} "
return
fi

PS1="${venv}${prompt_user}${prompt_symbol}${prompt_path} "
}

Expand Down
2 changes: 1 addition & 1 deletion version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Author: Diogo Alexsander Cavilha <[email protected]>
# Date: 11.17.2017

FANCYGIT_VERSION="6.0.0"
FANCYGIT_VERSION="6.0.1"

0 comments on commit 0798a3f

Please sign in to comment.