Displays a yellow heart if the current directory is a git repository

This commit is contained in:
Arialdo Martini 2013-09-02 00:02:16 +02:00
parent 5ad1ac07bb
commit 12360123b4

25
prompt.sh Normal file
View File

@ -0,0 +1,25 @@
function build_prompt {
PS1=""
on="\[\033[0;33m\]"
off="\[\033[1;31m\]"
blinking="\[\033[1;5;17m\]"
reset="\[\033[0m\]"
current_branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null)
git_repo_s="❤"
if [[ -z "$current_branch" ]]
then
git_repo=${off}
else
git_repo=${on}
fi
PS1="${PS1}${git_repo}${git_repo_s}"
PS1="${PS1}${reset}:"
}
#PREVIOUS_PROMPT=$PS1
PROMPT_COMMAND=build_prompt