Commit d1ce70f6 authored by grindhold's avatar grindhold Committed by Robby Russell
Browse files

added support for bazaar in agnoster theme (#5016)

the agnoster theme is now able to render basic information
if the user is currently residing inside a bazaar folder.
if so, it will render a green promt segment with "bzr" and
the current revision number in it. if there are untracked
files, the bar will be rendered in yellow. if there are
changes to already tracked files, a + character will be
printed.
parent fb8953d5
...@@ -127,6 +127,27 @@ prompt_git() { ...@@ -127,6 +127,27 @@ prompt_git() {
fi fi
} }
prompt_bzr() {
if (bzr status >/dev/null 2>&1); then
status_mod=`bzr status | head -n1 | grep "modified" | wc -m`
status_all=`bzr status | head -n1 | wc -m`
revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'`
if [[ $status_mod -gt 0 ]] ; then
prompt_segment yellow black
echo -n "bzr@"$revision "✚ "
else
if [[ $status_all -gt 0 ]] ; then
prompt_segment yellow black
echo -n "bzr@"$revision
else
prompt_segment green black
echo -n "bzr@"$revision
fi
fi
fi
}
prompt_hg() { prompt_hg() {
(( $+commands[hg] )) || return (( $+commands[hg] )) || return
local rev status local rev status
...@@ -198,6 +219,7 @@ build_prompt() { ...@@ -198,6 +219,7 @@ build_prompt() {
prompt_context prompt_context
prompt_dir prompt_dir
prompt_git prompt_git
prompt_bzr
prompt_hg prompt_hg
prompt_end prompt_end
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment