From d7948b39dc662c8072a307869135c8a7cae89cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Thu, 19 Apr 2018 23:32:53 +0200 Subject: [PATCH] [rkj-repos] Make `hg prompt` check less strict (#6746) * [rkj-repos] Make `hg prompt` check less strict Move the `hg prompt` check inside the hg_prompt_info function so that it returns an empty string if hg-prompt isn't installed. Fixes #6743. * [rkj-repos] Check for hg in `hg prompt` function --- themes/rkj-repos.zsh-theme | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme index 0d5a166ba..65a075456 100644 --- a/themes/rkj-repos.zsh-theme +++ b/themes/rkj-repos.zsh-theme @@ -1,16 +1,13 @@ # user, host, full path, and time/date on two lines for easier vgrepping -if ! grep -q "prompt" ~/.hgrc; then - echo "This theme requires 'hg prompt' (https://bitbucket.org/sjl/hg-prompt/overview)" - return 1 -fi - function hg_prompt_info { + if (( $+commands[hg] )) && grep -q "prompt" ~/.hgrc; then hg prompt --angle-brackets "\ %{$reset_color%}><:%{$fg[magenta]%}%{$reset_color%}>\ %{$reset_color%}>\ %{$fg[red]%}%{$reset_color%}< patches: >" 2>/dev/null + fi } ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+"