From 95908aa2bc8d6c243bf444a8620d9daf46c670f6 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sat, 26 Sep 2015 21:52:20 +0200 Subject: [PATCH] __fish_hg_prompt: Only show current bookmark --- share/functions/__fish_hg_prompt.fish | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/share/functions/__fish_hg_prompt.fish b/share/functions/__fish_hg_prompt.fish index 3d48bb7fa..efb7c7aaf 100644 --- a/share/functions/__fish_hg_prompt.fish +++ b/share/functions/__fish_hg_prompt.fish @@ -37,11 +37,13 @@ function __fish_hg_prompt --description 'Write out the hg prompt' return end - set -l bookmark (hg bookmark -q) - # Unfortunately, hg bookmark doesn't exit non-zero when there's no bookmark - if test -n "$bookmark" - set branch "$branch/$bookmark" - end + # With "-q", hg bookmark will always output every bookmark + # So our only option is to filter it ourselves + set -l bookmark (hg bookmark | string match ' \\**' | cut -d" " -f3) + # Unfortunately, hg bookmark doesn't exit non-zero when there's no bookmark + if test -n "$bookmark" + set branch "$branch/$bookmark" + end echo -n '|'