summaryrefslogtreecommitdiffstats
path: root/prompt.sh
diff options
context:
space:
mode:
authorMichael Allen <michael@michaelallen.io>2015-02-17 10:58:04 +0000
committerMichael Allen <michael@michaelallen.io>2015-02-17 10:58:04 +0000
commit8617edf7a1cd6cc8bcdc9ec64d9e11faa28221c2 (patch)
treea541ce3e176b41114219c76dcce5577247102ad5 /prompt.sh
parent62bca00c2ff42b502a03dc7f5d124736467c7968 (diff)
downloadgit-sonar-8617edf7a1cd6cc8bcdc9ec64d9e11faa28221c2.tar.gz
git-sonar-8617edf7a1cd6cc8bcdc9ec64d9e11faa28221c2.zip
an example prompt built using the git-base functions
Diffstat (limited to '')
-rwxr-xr-xprompt.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/prompt.sh b/prompt.sh
new file mode 100755
index 0000000..99ac6b3
--- /dev/null
+++ b/prompt.sh
@@ -0,0 +1,23 @@
+source ./git-base.sh
+
+local_ahead="$(commits_ahead_of_remote)"
+ahead_arrow="↑"
+
+if [[ ("$local_ahead" -gt 0) ]]; then
+ local_ahead=" ${local_ahead}${ahead_arrow}"
+else
+ local_ahead=""
+fi
+
+local_behind="$(commits_behind_of_remote)"
+behind_arrow="↓"
+
+if [[ "$local_behind" -gt "0" ]]; then
+ local_behind=" ${local_behind}${behind_arrow}"
+else
+ local_behind=""
+fi
+
+prompt="$(branch_name)$local_ahead$local_behind"
+
+echo $prompt