1
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-11-21 21:30:09 +00:00

refactor(bzr): simplify and improve code (#12716)

This commit is contained in:
mnv 2024-10-02 19:00:32 +05:30 committed by GitHub
parent dae5a41159
commit 00b9b62385
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,10 +1,14 @@
## Bazaar integration ## 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() { function bzr_prompt_info() {
BZR_CB=`bzr nick 2> /dev/null | grep -v "ERROR" | cut -d ":" -f2 | awk -F / '{print "bzr::"$1}'` local bzr_branch
if [ -n "$BZR_CB" ]; then bzr_branch=$(bzr nick 2>/dev/null) || return
BZR_DIRTY=""
[[ -n `bzr status` ]] && BZR_DIRTY=" %{$fg[red]%} * %{$fg[green]%}" if [[ -n "$bzr_branch" ]]; then
echo "$ZSH_THEME_SCM_PROMPT_PREFIX$BZR_CB$BZR_DIRTY$ZSH_THEME_GIT_PROMPT_SUFFIX" local bzr_dirty=""
fi 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
} }