summaryrefslogtreecommitdiff
path: root/lib/bzr.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bzr.zsh')
-rw-r--r--lib/bzr.zsh20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/bzr.zsh b/lib/bzr.zsh
index 005a16500..78273d578 100644
--- a/lib/bzr.zsh
+++ b/lib/bzr.zsh
@@ -1,10 +1,14 @@
## Bazaar integration
-## Just works with the GIT integration just add $(bzr_prompt_info) to the PROMPT
+## Just works with the GIT integration. Add $(bzr_prompt_info) to the PROMPT
function bzr_prompt_info() {
- BZR_CB=`bzr nick 2> /dev/null | grep -v "ERROR" | cut -d ":" -f2 | awk -F / '{print "bzr::"$1}'`
- if [ -n "$BZR_CB" ]; then
- BZR_DIRTY=""
- [[ -n `bzr status` ]] && BZR_DIRTY=" %{$fg[red]%} * %{$fg[green]%}"
- echo "$ZSH_THEME_SCM_PROMPT_PREFIX$BZR_CB$BZR_DIRTY$ZSH_THEME_GIT_PROMPT_SUFFIX"
- fi
-} \ No newline at end of file
+ local bzr_branch
+ bzr_branch=$(bzr nick 2>/dev/null) || return
+
+ if [[ -n "$bzr_branch" ]]; then
+ local bzr_dirty=""
+ if [[ -n $(bzr status 2>/dev/null) ]]; then
+ bzr_dirty=" %{$fg[red]%}*%{$reset_color%}"
+ fi
+ printf "%s%s%s%s" "$ZSH_THEME_SCM_PROMPT_PREFIX" "bzr::${bzr_branch##*:}" "$bzr_dirty" "$ZSH_THEME_GIT_PROMPT_SUFFIX"
+ fi
+}