diff --git a/.travis.yml b/.travis.yml index 1a5f7a1..56d72e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,11 @@ language: go go: + - "1.4.x" + - "1.5.x" + - "1.6.x" + - "1.7.x" + - "1.8.x" - "1.9.x" - "1.10.x" - "master" diff --git a/cointop/cointop.go b/cointop/cointop.go index 39458b3..d2ad959 100644 --- a/cointop/cointop.go +++ b/cointop/cointop.go @@ -45,6 +45,7 @@ type Cointop struct { savemux sync.Mutex cache *cache.Cache debug bool + helpview *gocui.View } // Run runs cointop diff --git a/cointop/help.go b/cointop/help.go index a51f53e..8537c48 100644 --- a/cointop/help.go +++ b/cointop/help.go @@ -1,15 +1,6 @@ package cointop -import ( - "github.com/miguelmota/cointop/pkg/open" -) - -// TODO: create a help menu func (ct *Cointop) openHelp() error { - open.URL(ct.helpLink()) + ct.setActiveView("help") return nil } - -func (ct *Cointop) helpLink() string { - return "https://github.com/miguelmota/cointop#shortcuts" -} diff --git a/cointop/layout.go b/cointop/layout.go index 94c0458..a6f410a 100644 --- a/cointop/layout.go +++ b/cointop/layout.go @@ -78,13 +78,34 @@ func (ct *Cointop) layout(g *gocui.Gui) error { ct.searchfield.Wrap = true ct.searchfield.Frame = false ct.searchfield.FgColor = gocui.ColorWhite + } - // run only once on init + helpwidth := 50 + helpheight := 25 + tablewidth := 182 + helpX := (tablewidth / 2) - (helpwidth / 2) + helpY := topOffset + 2 + if helpX <= 0 { + helpX = 5 + } + if v, err := g.SetView("help", helpX, helpY, helpX+helpwidth, helpY+helpheight); err != nil { + if err != gocui.ErrUnknownView { + return err + } + ct.helpview = v + ct.helpview.Frame = true + ct.helpview.BgColor = gocui.ColorBlack + ct.helpview.FgColor = gocui.ColorWhite + + // run only once on init. + // this bit of code should be at the bottom ct.g = g - g.SetViewOnBottom("searchfield") + g.SetViewOnBottom("searchfield") // hide + g.SetViewOnBottom("help") // hide ct.setActiveView("table") ct.intervalFetchData() } + return nil }