2019-02-02 04:39:34 +00:00
|
|
|
package console
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
ui "github.com/sqshq/termui"
|
|
|
|
"log"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2019-02-24 04:42:52 +00:00
|
|
|
MaxRenderInterval = 1000 * time.Millisecond
|
|
|
|
MinRenderInterval = 100 * time.Millisecond
|
|
|
|
AppTitle = "sampler"
|
2019-02-25 00:08:36 +00:00
|
|
|
AppVersion = "0.1.0"
|
2019-02-02 04:39:34 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Console struct{}
|
|
|
|
|
|
|
|
func (self *Console) Init() {
|
|
|
|
|
2019-02-24 04:42:52 +00:00
|
|
|
fmt.Printf("\033]0;%s\007", AppTitle)
|
2019-02-02 04:39:34 +00:00
|
|
|
|
|
|
|
if err := ui.Init(); err != nil {
|
|
|
|
log.Fatalf("failed to initialize termui: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (self *Console) Close() {
|
|
|
|
ui.Close()
|
|
|
|
}
|