From f683c005fec63d4c8d6b4ca5f27879b416b35ce1 Mon Sep 17 00:00:00 2001 From: Simon J Mudd Date: Sat, 22 Nov 2014 00:21:11 +0100 Subject: [PATCH] Show only short hostname to save a bit of space --- state/state.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/state/state.go b/state/state.go index 90c3f7d..0bacb2e 100644 --- a/state/state.go +++ b/state/state.go @@ -6,6 +6,7 @@ package state import ( "database/sql" "fmt" + "strings" "time" "github.com/sjmudd/pstop/lib" @@ -65,7 +66,11 @@ func (state *State) Setup(dbh *sql.DB) { state.show = showLatency state.tiwsbt.SetWantsLatency(true) + // get short name (to save space) _, hostname := lib.SelectGlobalVariableByVariableName(state.dbh, "HOSTNAME") + if index := strings.Index(hostname, "."); index >= 0 { + hostname = hostname[0:index] + } _, mysql_version := lib.SelectGlobalVariableByVariableName(state.dbh, "VERSION") _, datadir := lib.SelectGlobalVariableByVariableName(state.dbh, "DATADIR") state.SetHostname(hostname) -- 2.20.1