diff --git a/prompt.sh b/prompt.sh index 6a737b8..c801ed9 100644 --- a/prompt.sh +++ b/prompt.sh @@ -5,22 +5,31 @@ find_git_branch() { if [[ "$branch" == "HEAD" ]]; then branch='detached*' fi - git_branch="($branch)" + git_branch=" ($branch) " else - git_branch="" + git_branch=" " fi } find_git_dirty() { local status=$(git status --porcelain 2> /dev/null) if [[ "$status" != "" ]]; then - git_dirty='*' + git_dirty='* ' else git_dirty='' fi } -PROMPT_COMMAND="find_git_branch; find_git_dirty; $PROMPT_COMMAND" +find_git_stashes() { + local stash=$(git stash list 2> /dev/null) + if [[ "$stash" != "" ]]; then + git_stash='S ' + else + git_stash='' + fi +} + +PROMPT_COMMAND="find_git_branch; find_git_dirty; find_git_stashes; $PROMPT_COMMAND" # Default Git enabled prompt with dirty state # export PS1="\u@\h \w \[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ "