mirror of https://github.com/divan/expvarmon.git
Added String var kind
This commit is contained in:
parent
57d82c5544
commit
191559f45e
2
ui.go
2
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
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
|
|
3
var.go
3
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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue