summaryrefslogtreecommitdiff
path: root/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_git_branch.fish
diff options
context:
space:
mode:
Diffstat (limited to '.config/fisher/github.com/matchai/spacefish/functions/__sf_section_git_branch.fish')
-rw-r--r--.config/fisher/github.com/matchai/spacefish/functions/__sf_section_git_branch.fish28
1 files changed, 28 insertions, 0 deletions
diff --git a/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_git_branch.fish b/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_git_branch.fish
new file mode 100644
index 00000000..7a2c54e4
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_git_branch.fish
@@ -0,0 +1,28 @@
+#
+# Git branch
+#
+
+function __sf_section_git_branch -d "Format the displayed branch name"
+ # ------------------------------------------------------------------------------
+ # Configuration
+ # ------------------------------------------------------------------------------
+
+ __sf_util_set_default SPACEFISH_GIT_BRANCH_SHOW true
+ __sf_util_set_default SPACEFISH_GIT_BRANCH_PREFIX $SPACEFISH_GIT_SYMBOL
+ __sf_util_set_default SPACEFISH_GIT_BRANCH_SUFFIX ""
+ __sf_util_set_default SPACEFISH_GIT_BRANCH_COLOR magenta
+
+ # ------------------------------------------------------------------------------
+ # Section
+ # ------------------------------------------------------------------------------
+
+ [ $SPACEFISH_GIT_BRANCH_SHOW = false ]; and return
+
+ set -l git_branch (__sf_util_git_branch)
+
+ [ -z $git_branch ]; and return
+
+ __sf_lib_section \
+ $SPACEFISH_GIT_BRANCH_COLOR \
+ $SPACEFISH_GIT_BRANCH_PREFIX$git_branch$SPACEFISH_GIT_BRANCH_SUFFIX
+end