Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom dirty symbol. #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ your `PS1` variable, and make sure the variable value is defined with double
quotes. A set of color variables have also been set for you to use. For a list
of available colors check `colors.sh`.

If you would like to use a symbol other than '*' to indicate that the branch is
dirty, simply set the `dirtysmb` to whatever symbol you would like and export it.

## Updating

Expand Down
6 changes: 5 additions & 1 deletion prompt.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Users can set the dirtysymb env var in their .bash_profile, etc,
# or they can leave it unset and it will default to the '*'.
export dirtysymb=${dirtysymb:="*"};

find_git_branch() {
# Based on: http://stackoverflow.com/a/13003854/170413
local branch
Expand All @@ -14,7 +18,7 @@ find_git_branch() {
find_git_dirty() {
local status=$(git status --porcelain 2> /dev/null)
if [[ "$status" != "" ]]; then
git_dirty='*'
git_dirty=$dirtysymb
else
git_dirty=''
fi
Expand Down