sampler-fork/console/console.go

29 lines
605 B
Go
Raw Normal View History

package console
import (
"fmt"
ui "github.com/sqshq/termui"
"log"
"time"
)
const (
2019-02-03 03:30:45 +00:00
RenderRate = 50 * time.Millisecond // TODO not a constant, should be dynamically chosen based on min X scale (per each chart? should be tested). if it is 1 sec, it should be 100 ms, if 2 - 200 ms, if 3 - 300, 4 - 400, 5 - 500 and 500 is max. smth like that.
2019-02-02 14:30:30 +00:00
Title = "sampler"
)
type Console struct{}
func (self *Console) Init() {
fmt.Printf("\033]0;%s\007", Title)
if err := ui.Init(); err != nil {
log.Fatalf("failed to initialize termui: %v", err)
}
}
func (self *Console) Close() {
ui.Close()
}