if [ -d /opt/local/bin ]; then
PATH="$PATH:/opt/local/bin:/opt/local/sbin"
fi
if [ -d /opt/local/lib/postgresql83/bin ]; then
PATH="$PATH:/opt/local/lib/postgresql83/bin"
fi
if [ -d /usr/local/ImageMagick/bin ]; then
PATH="$PATH:/usr/local/ImageMagick/bin"
fi
if [ -d /opt/ruby-enterprise/bin ]; then
PATH="/opt/ruby-enterprise/bin:$PATH"
fi
if uname -s | grep -q Darwin; then
top ()
{
if [ $# -gt 0 ]; then
/usr/bin/top "$@"
else
/usr/bin/top -o cpu -s 5
fi
}
fi
function git_current_branch {
local branch=$(git branch 2>/dev/null | grep '^*' | cut -d' ' -f2-)
[[ $branch ]] && echo "[$branch$(git_needs_push)$(git_branch_dirty)]"
}
function git_branch_dirty {
[[ $(git status 2>/dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo -e "\033[01;33m*\033[00m"
}
function git_needs_push {
git status 2>/dev/null | egrep -q 'is ahead|have diverged' && echo -e "\033[01;31m!\033[00m"
}