3 ms·
function parse_git_dirty { [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" } function par
by ashleyw 17y ago
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
function parse_current_dir {
ruby -e "puts ('../'+Dir.getwd.split('/').last(2).join('/')).gsub('//', '/')"
}
export PS1='\[\033[31;40m\]$(parse_current_dir)\[\033[0;33m\]$(parse_git_branch)\[\e[0m\]$ '
I couldn't be bothered to work out how to shorten the path natively, so I hacked it [badly] ]in ruby... :)
http://grab.by/3Gg http://grab.by/3Gg