From d1ce70f68540bdf6a7f27ab9879e8222d0e7a604 Mon Sep 17 00:00:00 2001 From: grindhold Date: Tue, 20 Sep 2016 05:00:42 +0200 Subject: 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. --- themes/agnoster.zsh-theme | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'themes/agnoster.zsh-theme') diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index da1f9b6e6..e1a294ee8 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -127,6 +127,27 @@ prompt_git() { 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() { (( $+commands[hg] )) || return local rev status @@ -198,6 +219,7 @@ build_prompt() { prompt_context prompt_dir prompt_git + prompt_bzr prompt_hg prompt_end } -- cgit v1.2.3-70-g09d2 From 7e5483d672aab9764231d9a569b6c7451474eecb Mon Sep 17 00:00:00 2001 From: Dawnflash Lightstring Date: Wed, 21 Sep 2016 12:20:08 +0200 Subject: Add check for git and bzr to agnoster theme Plugin command-not-found on Arch Linux returns 0 if git or bzr is found in repos, hence outputting unwanted pkgfile output. Checking if the commands exist first fixes all such issues. --- themes/agnoster.zsh-theme | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'themes/agnoster.zsh-theme') diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index e1a294ee8..07546fd34 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -86,7 +86,7 @@ prompt_context() { # Git: branch/detached head, dirty status prompt_git() { - + (( $+commands[git] )) || return local PL_BRANCH_CHAR () { local LC_ALL="" LC_CTYPE="en_US.UTF-8" @@ -128,6 +128,7 @@ prompt_git() { } prompt_bzr() { + (( $+commands[bzr] )) || return 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` -- cgit v1.2.3-70-g09d2