64e12f95da2e

Added more to the README.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Fri, 19 Jun 2009 22:09:21 -0400
parents c4ce712862c3
children 10cfd4478857
branches/tags (none)
files README

Changes

--- a/README	Fri Jun 19 21:57:19 2009 -0400
+++ b/README	Fri Jun 19 22:09:21 2009 -0400
@@ -55,6 +55,31 @@
 * bookmark: the current bookmark
 * branch: the current branch
 * status:
-  * `!` if the repository has any changed, added, removed or deleted files, otherwise
-  * `?` if the repository has any untracked (but not ignored) files, otherwise
-  * nothing
\ No newline at end of file
+    * `!` if the repository has any changed, added, removed or deleted files, otherwise
+    * `?` if the repository has any untracked (but not ignored) files, otherwise
+    * nothing
+
+Putting it in a Bash Prompt
+---------------------------
+
+To put it in your bash prompt, edit your `~/.bashrc` file to include something like this:
+
+    hg_ps1() {
+        hg prompt "{ on {branch}}{ at {bookmark}}{status}" 2> /dev/null
+    }
+    
+    export PS1='\u at \h in \w$(hg_ps1) $ '
+
+Putting the call in a separate function helps keep things readable if you start adding color codes:
+
+    D=$'\e[37;40m'
+    MAGENTA=$'\e[35;40m'
+    GREEN=$'\e[32;40m'
+    YELLOW=$'\e[33;40m'
+
+    hg_ps1() {
+        hg prompt "{${D} on ${MAGENTA}{branch}}{${D} at ${YELLOW}{bookmark}}{${GREEN}{status}}" 2> /dev/null
+    }
+
+    export PS1='\n${MAGENTA}\u ${D}at ${YELLOW}\h ${D}in ${GREEN}\w$(hg_ps1)\
+    ${D}\n$ '
\ No newline at end of file