From 12360123b4222abe5654d9d8db73b698f443838e Mon Sep 17 00:00:00 2001 From: Arialdo Martini Date: Mon, 2 Sep 2013 00:02:16 +0200 Subject: [PATCH] Displays a yellow heart if the current directory is a git repository --- prompt.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 prompt.sh diff --git a/prompt.sh b/prompt.sh new file mode 100644 index 0000000..bd0bb5f --- /dev/null +++ b/prompt.sh @@ -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