summaryrefslogtreecommitdiff
path: root/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_host.fish
diff options
context:
space:
mode:
Diffstat (limited to '.config/fisher/github.com/matchai/spacefish/functions/__sf_section_host.fish')
-rw-r--r--.config/fisher/github.com/matchai/spacefish/functions/__sf_section_host.fish41
1 files changed, 41 insertions, 0 deletions
diff --git a/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_host.fish b/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_host.fish
new file mode 100644
index 00000000..bd0bdd84
--- /dev/null
+++ b/.config/fisher/github.com/matchai/spacefish/functions/__sf_section_host.fish
@@ -0,0 +1,41 @@
+#
+# Hostname
+#
+
+
+# If there is an ssh connections, current machine name.
+function __sf_section_host -d "Display the current hostname if connected over SSH"
+
+ # ------------------------------------------------------------------------------
+ # Configuration
+ # ------------------------------------------------------------------------------
+
+ __sf_util_set_default SPACEFISH_HOST_SHOW true
+ __sf_util_set_default SPACEFISH_HOST_PREFIX "at "
+ __sf_util_set_default SPACEFISH_HOST_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
+ __sf_util_set_default SPACEFISH_HOST_COLOR blue
+ __sf_util_set_default SPACEFISH_HOST_COLOR_SSH green
+
+ # ------------------------------------------------------------------------------
+ # Section
+ # ------------------------------------------------------------------------------
+
+ [ "$SPACEFISH_HOST_SHOW" = false ]; and return
+
+ if test "$SPACEFISH_HOST_SHOW" = "always"; or set -q SSH_CONNECTION;
+
+ # Determination of what color should be used
+ set -l host_color
+ if set -q SSH_CONNECTION;
+ set host_color $SPACEFISH_HOST_COLOR_SSH
+ else
+ set host_color $SPACEFISH_HOST_COLOR
+ end
+
+ __sf_lib_section \
+ $host_color \
+ $SPACEFISH_HOST_PREFIX \
+ (hostname) \
+ $SPACEFISH_HOST_SUFFIX
+ end
+end