From 191559f45ec2615313ed0b8ab0c96c0dc326a41f Mon Sep 17 00:00:00 2001 From: Ivan Daniluk Date: Sat, 2 May 2015 21:43:32 +0300 Subject: [PATCH] Added String var kind --- ui.go | 2 ++ ui_single.go | 3 +++ var.go | 3 +++ 3 files changed, 8 insertions(+) diff --git a/ui.go b/ui.go index 161afad..8b10bb8 100644 --- a/ui.go +++ b/ui.go @@ -160,6 +160,8 @@ func colorByKind(kind VarKind) termui.Attribute { return termui.ColorRed | termui.AttrBold case KindDuration: return termui.ColorYellow | termui.AttrBold + case KindString: + return termui.ColorGreen | termui.AttrBold default: return termui.ColorBlue | termui.AttrBold } diff --git a/ui_single.go b/ui_single.go index fb14f45..fad1e19 100644 --- a/ui_single.go +++ b/ui_single.go @@ -88,6 +88,9 @@ func (t *TermUISingle) Update(data UIData) { // Sparklines for i, name := range data.Vars { + if name.Kind() == KindString { + continue + } spl := &t.Sparkline.Lines[i] spl.Title = fmt.Sprintf("%s: %v", name.Long(), service.Value(name)) spl.TitleColor = colorByKind(name.Kind()) diff --git a/var.go b/var.go index 45809a0..4d68e35 100644 --- a/var.go +++ b/var.go @@ -16,6 +16,7 @@ const ( KindDefault VarKind = iota KindMemory KindDuration + KindString ) // ToSlice converts "dot-separated" notation into the "slice of strings". @@ -62,6 +63,8 @@ func (v VarName) Kind() VarKind { return KindMemory case "duration": return KindDuration + case "str": + return KindString } return KindDefault }