Add check for git and bzr to agnoster theme (#5432)
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.
Diff
1diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
2index e1a294ee8e3868094edc155120c1eafc545bbf5d..07546fd34d437a4b04f89939d2a536a7b5451f7e 100644
3--- a/themes/agnoster.zsh-theme
4+++ b/themes/agnoster.zsh-theme
5@@ -86,7 +86,7 @@ prompt_context() {
6 7 # Git: branch/detached head, dirty status
8 prompt_git() {
9-
10+ (( $+commands[git] )) || return
11 local PL_BRANCH_CHAR
12 () {
13 local LC_ALL="" LC_CTYPE="en_US.UTF-8"
14@@ -128,6 +128,7 @@ prompt_git() {
15 }
1617 prompt_bzr() {
18+ (( $+commands[bzr] )) || return
19 if (bzr status >/dev/null 2>&1); then
20 status_mod=`bzr status | head -n1 | grep "modified" | wc -m`
21 status_all=`bzr status | head -n1 | wc -m`