From b0c51f55450c317e8ec4bd5daecaa58539334cb0 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 22 May 2018 01:53:04 -0400 Subject: strip off hostname part following the '.' osx puts a bunch of worthless (and constantly changing for no reason) things in the hostname, which just is more confusing than anything else --- src/data.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/data.rs b/src/data.rs index be6ea9f..e1a77a0 100644 --- a/src/data.rs +++ b/src/data.rs @@ -63,7 +63,15 @@ pub fn collect(opts: args::CommandLineOptions) -> PromptData { } fn hostname() -> Option { - hostname::get_hostname() + if let Some(mut name) = hostname::get_hostname() { + if let Some(idx) = name.find('.') { + name.truncate(idx); + } + Some(name) + } + else { + None + } } fn terminal_cols() -> Option { -- cgit v1.2.3