|
|
@ -29,6 +29,7 @@ func newLog(path string) *blammo.Log {
|
|
|
|
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
func main() {
|
|
|
|
log := newLog("./belt.log")
|
|
|
|
log := newLog("./belt.log")
|
|
|
|
|
|
|
|
|
|
|
|
start := time.Now()
|
|
|
|
start := time.Now()
|
|
|
|
log.Info("starting at: %v", start)
|
|
|
|
log.Info("starting at: %v", start)
|
|
|
|
defer func() {
|
|
|
|
defer func() {
|
|
|
@ -42,13 +43,40 @@ func main() {
|
|
|
|
exit.WithMessage(1, "unable to create a screen: %v", err)
|
|
|
|
exit.WithMessage(1, "unable to create a screen: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
log.Debug("sceen created")
|
|
|
|
log.Debug("sceen created")
|
|
|
|
|
|
|
|
|
|
|
|
if err := screen.Init(); err != nil {
|
|
|
|
if err := screen.Init(); err != nil {
|
|
|
|
exit.WithMessage(1, "unable to initialize screen: %v", err)
|
|
|
|
exit.WithMessage(1, "unable to initialize screen: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
log.Debug("screen initialized")
|
|
|
|
log.Debug("screen initialized")
|
|
|
|
defer screen.Fini()
|
|
|
|
width, height := screen.Size()
|
|
|
|
|
|
|
|
log.Debug("screen width: %d", width)
|
|
|
|
|
|
|
|
log.Debug("screen height: %d", height)
|
|
|
|
|
|
|
|
log.Debug("screen colors: %v", screen.Colors())
|
|
|
|
|
|
|
|
log.Debug("screen has mouse: %v", screen.HasMouse())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
|
|
|
|
log.Debug("finalizing screen")
|
|
|
|
|
|
|
|
screen.Fini()
|
|
|
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
|
|
log.Debug("clearing screen")
|
|
|
|
log.Debug("clearing screen")
|
|
|
|
|
|
|
|
for {
|
|
|
|
|
|
|
|
e := screen.PollEvent()
|
|
|
|
|
|
|
|
if e == nil {
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
switch v := e.(type) {
|
|
|
|
|
|
|
|
case *tcell.EventKey:
|
|
|
|
|
|
|
|
log.Debug("screen saw key event: %v", v.Key())
|
|
|
|
|
|
|
|
key := v.Key()
|
|
|
|
|
|
|
|
if key == tcell.KeyCtrlC {
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
log.Debug("screen saw unhandled event of type %T", e)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
screen.Clear()
|
|
|
|
screen.Clear()
|
|
|
|
|
|
|
|
|
|
|
|
time.Sleep(1 * time.Second)
|
|
|
|
time.Sleep(1 * time.Second)
|
|
|
|
}
|
|
|
|
}
|
|
|
|