Skip to content

Commit

Permalink
Merge pull request #35 from diogocavilha/venv-as-ghost
Browse files Browse the repository at this point in the history
✨ Add a ghost icon for Python virtual environment
  • Loading branch information
diogocavilha authored Jun 22, 2019
2 parents b625cd6 + c43fdff commit 92cf7a0
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 43 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.2

- Add a ghost icon to indicate you're working on a Python virtual environment. (Only colored themes)

### v6.0.1

- Fix Python virtual environment when in a git repository path.
Expand Down
2 changes: 2 additions & 0 deletions config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local is_git_repo
local has_untracked_files
local has_changed_files
local has_added_files
local working_on_venv

separator=""
branch_icon=""
Expand All @@ -21,6 +22,7 @@ has_untracked_files=" "
has_changed_files=""
has_added_files=""
has_unpushed_commits=""
working_on_venv=""

# Git info
local branch_name
Expand Down
1 change: 1 addition & 0 deletions help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ echo " Fancy Git v$FANCYGIT_VERSION - $fg_current_year by Diogo Alexsander Cavil
 = There are added files waiting to be committed.
 = There are stashes.
 = There are commits waiting to be pushed.
 = You are working on a Python virtual environment.
ICONS MEANING FOR SIMPLE STYLE
Expand Down
13 changes: 6 additions & 7 deletions prompt_styles/dark-double-line.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ fancygit_prompt_builder() {

prompt_user="${user_at_host}\\u@\\h ${user_at_host_end}"
prompt_symbol="\n${user_symbol}\$${user_symbol_end}"
prompt_path="${path}${bold}${white} \\w ${path_end}${s_darkgray}"

local only_local_branch=$(git branch -a 2> /dev/null | egrep "remotes/origin/${branch_name}" | wc -l)

Expand All @@ -74,20 +73,20 @@ fancygit_prompt_builder() {

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}"
venv="$working_on_venv"
fi

prompt_path="${path}${bold}${white}${venv} \\w ${path_end}${s_darkgray}"

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_path="${path_git}${venv}${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} "
PS1="${prompt_user}${prompt_path}${prompt_branch}${prompt_symbol} "
return
fi

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

PROMPT_COMMAND="fancygit_prompt_builder"
13 changes: 6 additions & 7 deletions prompt_styles/dark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ fancygit_prompt_builder() {

prompt_user="${user_at_host}\\u@\\h ${user_at_host_end}"
prompt_symbol="${user_symbol} \$ ${user_symbol_end}"
prompt_path="${path}${bold}${white} \\w ${path_end}${s_darkgray01}"

local only_local_branch=$(git branch -a 2> /dev/null | egrep "remotes/origin/${branch_name}" | wc -l)

Expand All @@ -74,20 +73,20 @@ fancygit_prompt_builder() {

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}"
venv="$working_on_venv"
fi

prompt_path="${path}${bold}${white}${venv} \\w ${path_end}${s_darkgray01}"

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_path="${path_git}${venv}${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} "
PS1="${prompt_user}${prompt_symbol}${prompt_path}${prompt_branch} "
return
fi

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

PROMPT_COMMAND="fancygit_prompt_builder"
13 changes: 6 additions & 7 deletions prompt_styles/default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ fancygit_prompt_builder() {

prompt_user="${user_at_host}\\u@\\h ${user_at_host_end}"
prompt_symbol="${user_symbol} \$ ${user_symbol_end}"
prompt_path="${path}${bold}${white} \\w ${path_end}${s_blue}"

local only_local_branch=$(git branch -a 2> /dev/null | egrep "remotes/origin/${branch_name}" | wc -l)

Expand All @@ -74,20 +73,20 @@ fancygit_prompt_builder() {

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}"
venv="$working_on_venv"
fi

prompt_path="${path}${bold}${white}${venv} \\w ${path_end}${s_blue}"

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_path="${path_git}${venv}${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} "
PS1="${prompt_user}${prompt_symbol}${prompt_path}${prompt_branch} "
return
fi

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

PROMPT_COMMAND="fancygit_prompt_builder"
13 changes: 6 additions & 7 deletions prompt_styles/fancy-double-line.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ fancygit_prompt_builder() {

prompt_user="${user_at_host}\\u@\\h ${user_at_host_end}"
prompt_symbol="\n${user_symbol}\$${user_symbol_end}"
prompt_path="${path}${bold}${white} \\w ${path_end}${s_blue}"

local only_local_branch=$(git branch -a 2> /dev/null | egrep "remotes/origin/${branch_name}" | wc -l)

Expand All @@ -74,20 +73,20 @@ fancygit_prompt_builder() {

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}"
venv="$working_on_venv"
fi

prompt_path="${path}${bold}${white}${venv} \\w ${path_end}${s_blue}"

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_path="${path_git}${venv}${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} "
PS1="${prompt_user}${prompt_path}${prompt_branch}${prompt_symbol} "
return
fi

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

PROMPT_COMMAND="fancygit_prompt_builder"
13 changes: 6 additions & 7 deletions prompt_styles/light-double-line.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ fancygit_prompt_builder() {

prompt_user="${user_at_host}\\u@\\h ${user_at_host_end}"
prompt_symbol="\n${user_symbol}\$${user_symbol_end}"
prompt_path="${path}${bold}${black} \\w ${path_end}${s_lightgray}"

local only_local_branch=$(git branch -a 2> /dev/null | egrep "remotes/origin/${branch_name}" | wc -l)

Expand All @@ -74,20 +73,20 @@ fancygit_prompt_builder() {

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}"
venv="$working_on_venv"
fi

prompt_path="${path}${bold}${black}${venv} \\w ${path_end}${s_lightgray}"

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_path="${path_git}${venv}${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} "
PS1="${prompt_user}${prompt_path}${prompt_branch}${prompt_symbol} "
return
fi

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

PROMPT_COMMAND="fancygit_prompt_builder"
13 changes: 6 additions & 7 deletions prompt_styles/light.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ fancygit_prompt_builder() {

prompt_user="${user_at_host}\\u@\\h ${user_at_host_end}"
prompt_symbol="${user_symbol} \$ ${user_symbol_end}"
prompt_path="${path}${bold}${black} \\w ${path_end}${s_lightgray}"

local only_local_branch=$(git branch -a 2> /dev/null | egrep "remotes/origin/${branch_name}" | wc -l)

Expand All @@ -74,20 +73,20 @@ fancygit_prompt_builder() {

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}"
venv="$working_on_venv"
fi

prompt_path="${path}${bold}${black}${venv} \\w ${path_end}${s_lightgray}"

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_path="${path_git}${venv}${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} "
PS1="${prompt_user}${prompt_symbol}${prompt_path}${prompt_branch} "
return
fi

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

PROMPT_COMMAND="fancygit_prompt_builder"
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.1"
FANCYGIT_VERSION="6.0.2"

0 comments on commit 92cf7a0

Please sign in to comment.