diff options
author | Cody Hiar <chiar@hybridforge.com> | 2015-08-12 12:06:23 -0600 |
---|---|---|
committer | Cody Hiar <chiar@hybridforge.com> | 2015-08-12 12:06:23 -0600 |
commit | 07fc2644a237187dd4c5680e88f4adadbf533603 (patch) | |
tree | bb6335e180df48c5a6f0b893312857d36ad470f7 /segments/hostname.sh |
Initial commit of the working files
Diffstat (limited to 'segments/hostname.sh')
-rwxr-xr-x | segments/hostname.sh | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/segments/hostname.sh b/segments/hostname.sh new file mode 100755 index 0000000..c3dfbf9 --- /dev/null +++ b/segments/hostname.sh @@ -0,0 +1,31 @@ +# Prints the hostname. + +TMUX_POWERLINE_SEG_HOSTNAME_FORMAT_DEFAULT="short" + +generate_segmentrc() { + read -d '' rccontents << EORC +# Use short or long format for the hostname. Can be {"short, long"}. +export TMUX_POWERLINE_SEG_HOSTNAME_FORMAT="${TMUX_POWERLINE_SEG_HOSTNAME_FORMAT_DEFAULT}" +EORC + echo "$rccontents" +} + +__process_settings() { + if [ -z "$TMUX_POWERLINE_SEG_HOSTNAME_FORMAT" ]; then + export TMUX_POWERLINE_SEG_HOSTNAME_FORMAT="${TMUX_POWERLINE_SEG_HOSTNAME_FORMAT_DEFAULT}" + fi +} +run_segment() { + __process_settings + local opts="" + if [ "$TMUX_POWERLINE_SEG_HOSTNAME_FORMAT" == "short" ]; then + if shell_is_osx || shell_is_bsd; then + opts="-s" + else + opts="--short" + fi + fi + + hostname ${opts} + return 0 +} |