open link help

Former-commit-id: 5783e7f7c8f6d0f3d58bead045dee39f8cf5cbe2 [formerly 5783e7f7c8f6d0f3d58bead045dee39f8cf5cbe2 [formerly f6a515de2f6dc9bd97c9cb6cc0e10950ccd7566a [formerly fe1a3bcebe]]]
Former-commit-id: 02604f51a652c8dbeb4fbd94d75cc564d688fbd8
Former-commit-id: 9f5b365109d599f98d02300e6301b1f35cd16bdf [formerly 6ce08da9d1db215c22050cf7af33f4c97cfd3f85]
Former-commit-id: 82d0a4ada5fa0912e2de63eaaaadda685f8fe051
pull/15/head
Miguel Mota 6 years ago
parent d47824bd28
commit a1dd05c4e0

@ -78,6 +78,9 @@ Key|Action
<kbd>Ctrl</kbd>+<kbd>p</kbd>|Go to previous page (vim style)
<kbd>Ctrl</kbd>+<kbd>r</kbd>|Force refresh
<kbd>Ctrl</kbd>+<kbd>u</kbd>|Jump page up (vim style)
<kbd>Alt</kbd>+<kbd></kbd>|Sort next column to the left
<kbd>Alt</kbd>+<kbd></kbd>|Sort next column to the right
<kbd>F1</kbd>|Show help|
<kbd>0</kbd>|Go to first page (vim style)
<kbd>1</kbd>|Sort table by *[1] hour change*
<kbd>2</kbd>|Sort table by *[2]4 hour change*
@ -102,11 +105,7 @@ Key|Action
<kbd>v</kbd>|Sort table by *24 hour [v]olume*
<kbd>q</kbd>|[q]uit
<kbd>$</kbd>|Go to last page (vim style)
<!--
|`h`|toggle [h]elp|
|`?`|alias to help|
-->
<kbd>?</kbd>|Show help|
## FAQ

@ -0,0 +1,16 @@
package cointop
import (
"os/exec"
"github.com/jroimartin/gocui"
)
func (ct *Cointop) openHelp(g *gocui.Gui, v *gocui.View) error {
exec.Command("open", ct.helpLink()).Output()
return nil
}
func (ct *Cointop) helpLink() string {
return "https://github.com/miguelmota/cointop"
}

@ -42,9 +42,9 @@ func (ct *Cointop) keybindings(g *gocui.Gui) error {
ct.setKeybinding(gocui.KeyPgup, ct.pageUp)
ct.setKeybinding(gocui.KeyHome, ct.navigateFirstLine)
ct.setKeybinding(gocui.KeyEnd, ct.navigateLastLine)
ct.setKeybinding(gocui.KeyEnter, ct.enter)
ct.setKeybinding(gocui.KeyEnter, ct.openLink)
ct.setKeybinding(gocui.KeyEsc, ct.quit)
ct.setKeybinding(gocui.KeySpace, ct.enter)
ct.setKeybinding(gocui.KeySpace, ct.openLink)
ct.setKeybinding(gocui.KeyCtrlC, ct.quit)
ct.setKeybinding(gocui.KeyCtrlD, ct.pageDown)
ct.setKeybinding(gocui.KeyCtrlN, ct.nextPage)
@ -53,6 +53,7 @@ func (ct *Cointop) keybindings(g *gocui.Gui) error {
ct.setKeybinding(gocui.KeyCtrlU, ct.pageUp)
ct.setKeybindingMod(gocui.KeyArrowLeft, gocui.ModAlt, ct.sortPrevCol)
ct.setKeybindingMod(gocui.KeyArrowRight, gocui.ModAlt, ct.sortNextCol)
ct.setKeybinding(gocui.KeyF1, ct.openHelp)
ct.setKeybinding('0', ct.firstPage)
ct.setKeybinding('1', ct.sortfn("1hchange", true))
ct.setKeybinding('2', ct.sortfn("24hchange", true))
@ -77,6 +78,7 @@ func (ct *Cointop) keybindings(g *gocui.Gui) error {
ct.setKeybinding('v', ct.sortfn("24hvolume", true))
ct.setKeybinding('q', ct.quit)
ct.setKeybinding('$', ct.lastPage)
ct.setKeybinding('?', ct.openHelp)
return nil
}
@ -85,7 +87,7 @@ func (ct *Cointop) refresh(g *gocui.Gui, v *gocui.View) error {
return nil
}
func (ct *Cointop) enter(g *gocui.Gui, v *gocui.View) error {
func (ct *Cointop) openLink(g *gocui.Gui, v *gocui.View) error {
exec.Command("open", ct.rowLink()).Output()
return nil
}

@ -12,7 +12,7 @@ func (ct *Cointop) updateStatusbar(s string) {
ct.statusbarview.Clear()
currpage := ct.getCurrentPage()
totalpages := ct.getTotalPages()
fmt.Fprintln(ct.statusbarview, pad.Right(fmt.Sprintf("[q]uit [h]elp [← →]page %v/%v %s", currpage, totalpages, s), maxX, " "))
fmt.Fprintln(ct.statusbarview, pad.Right(fmt.Sprintf("[q]uit [?]help [← →]page %v/%v %s", currpage, totalpages, s), maxX, " "))
})
}

Loading…
Cancel
Save