bash/prompt @ f8f5df21305c

Readd the tmd alias.
author Steve Losh <steve@stevelosh.com>
date Sun, 01 Nov 2009 17:46:24 -0500
parents 11c087d7ffe0
children b8355d9279d4
#!/usr/bin/env bash

D=$'\[\e[37;40m\]'
PINK=$'\[\e[35;40m\]'
GREEN=$'\[\e[32;40m\]'
ORANGE=$'\[\e[33;40m\]'

hg_ps1() {
  hg prompt "\
{${D} on ${PINK}{branch}}\
{${D} at ${ORANGE}{tags|${D}, ${ORANGE}}}\
{${GREEN}{status|modified|unknown}}{${GREEN}{update}}" 2> /dev/null
}

tasks_ps1() {
    t | wc -l | sed -e's/ *//'
}

render_ps1() {
  echo "\n\
${PINK}\u ${D}at ${ORANGE}\h ${D}in ${GREEN}\w$(hg_ps1)${D}\n\
[$(tasks_ps1)] $([ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' )$ "
}

PROMPT_COMMAND="$(echo "$PROMPT_COMMAND"|sed -e's/PS1="`render_ps1`";//g')"
PROMPT_COMMAND='PS1="`render_ps1`";'"$PROMPT_COMMAND"