diff options
author | Roger Gonzalez <rogergonzalez21@gmail.com> | 2019-12-29 14:58:33 -0300 |
---|---|---|
committer | Roger Gonzalez <rogergonzalez21@gmail.com> | 2019-12-29 14:58:33 -0300 |
commit | efb336a23b65a9a2d56889396b13c1757bdaf354 (patch) | |
tree | 234e40115f79a84c8a755df6fb932cc6797e36e1 /.config/fisher/github.com/matchai/spacefish/functions/__sf_section_host.fish |
Initial commit
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.fish | 41 |
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 |