diff dot_config/private_fish/functions/fish_right_prompt.fish @ 1038:6ab26ddbf78d

feat: add fish shell
author Zeger Van de Vannet <zeger@vandevan.net>
date Fri, 26 Apr 2024 18:43:22 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dot_config/private_fish/functions/fish_right_prompt.fish	Fri Apr 26 18:43:22 2024 +0200
@@ -0,0 +1,18 @@
+function fish_right_prompt
+    if not command -sq hg
+        return 1
+    end
+
+    set -l root (fish_print_hg_root)
+    or return 1
+
+    # In stead of running this command, cat the branch and topic name from the .hg folder
+    # echo (set_color yellow)(HGPLAIN= HGRCPATH= hg --config extensions.topic= log -r 'wdir()' --template='{fqbn}' 2>/dev/null) (set_color normal)
+    set -l branch (cat $root/branch 2>/dev/null; or echo default)
+    if set -l topic (cat $root/topic 2>/dev/null)
+        set branch "$branch//$topic"
+    end
+    # TODO: add topic namespace when available
+
+    echo (set_color green)"$branch "(set_color normal)
+end