2019-06-16 15:23:24 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2019-06-19 14:58:48 +00:00
|
|
|
"github.com/jroimartin/gocui"
|
2019-06-16 15:23:24 +00:00
|
|
|
"log"
|
|
|
|
)
|
|
|
|
|
|
|
|
type rcpResp map[string]interface{}
|
|
|
|
|
2019-06-16 16:02:50 +00:00
|
|
|
const host = "127.0.0.1"
|
|
|
|
const port = 8545
|
2019-06-16 15:23:24 +00:00
|
|
|
|
|
|
|
func main() {
|
2019-06-19 14:58:48 +00:00
|
|
|
g, err := gocui.NewGui(gocui.OutputNormal)
|
2019-06-16 15:23:24 +00:00
|
|
|
if err != nil {
|
2019-06-19 14:58:48 +00:00
|
|
|
log.Panicln(err)
|
2019-06-16 15:23:24 +00:00
|
|
|
}
|
2019-06-19 14:58:48 +00:00
|
|
|
defer g.Close()
|
2019-06-16 16:02:50 +00:00
|
|
|
|
2019-06-19 14:58:48 +00:00
|
|
|
g.SetManagerFunc(layout)
|
|
|
|
|
|
|
|
if err := g.SetKeybinding("", gocui.KeyCtrlC, gocui.ModNone, quit); err != nil {
|
|
|
|
log.Panicln(err)
|
2019-06-16 15:23:24 +00:00
|
|
|
}
|
2019-06-19 14:58:48 +00:00
|
|
|
|
|
|
|
if err := g.MainLoop(); err != nil && err != gocui.ErrQuit {
|
|
|
|
log.Panicln(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func layout(g *gocui.Gui) error {
|
|
|
|
maxX, maxY := g.Size()
|
|
|
|
if v, err := g.SetView("hello", 0, 0, maxX-1, maxY-1); err != nil {
|
|
|
|
if err != gocui.ErrUnknownView {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
fmt.Fprintln(v, "Hello world!")
|
|
|
|
fmt.Fprintln(v, "Hello world!")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func quit(g *gocui.Gui, v *gocui.View) error {
|
|
|
|
return gocui.ErrQuit
|
2019-06-16 15:23:24 +00:00
|
|
|
}
|