2015-04-21 12:51:01 +03:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2015-05-01 20:51:22 +03:00
|
|
|
"time"
|
2015-04-21 12:51:01 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// DummyUI is an simple console UI mockup, for testing purposes.
|
|
|
|
type DummyUI struct{}
|
|
|
|
|
2015-05-01 19:13:23 +03:00
|
|
|
// Init implements UI.
|
2015-05-01 18:48:34 +03:00
|
|
|
func (*DummyUI) Init(UIData) error { return nil }
|
2015-05-01 19:13:23 +03:00
|
|
|
|
|
|
|
// Close implements UI.
|
|
|
|
func (*DummyUI) Close() {}
|
|
|
|
|
|
|
|
// Update implements UI.
|
2015-05-01 14:37:28 +03:00
|
|
|
func (*DummyUI) Update(data UIData) {
|
2015-04-21 12:51:01 +03:00
|
|
|
if data.Services == nil {
|
|
|
|
return
|
|
|
|
}
|
2015-05-01 20:51:22 +03:00
|
|
|
fmt.Println(time.Now().Format("15:04:05 02/01"))
|
2015-04-21 12:51:01 +03:00
|
|
|
for _, service := range data.Services {
|
|
|
|
fmt.Printf("%s: ", service.Name)
|
|
|
|
if service.Err != nil {
|
|
|
|
fmt.Printf("ERROR: %s", service.Err)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2015-05-01 20:51:22 +03:00
|
|
|
for _, name := range data.Vars {
|
|
|
|
fmt.Printf("%s: %v, ", name.Short(), service.Value(name))
|
|
|
|
}
|
|
|
|
|
2015-04-21 12:51:01 +03:00
|
|
|
fmt.Printf("\n")
|
|
|
|
}
|
|
|
|
}
|