mirror of
https://github.com/miguelmota/cointop
synced 2024-11-14 18:12:57 +00:00
move to last line shortcut
Former-commit-id: 06752f94ab09498f47027348673afbdd8815590c [formerly 06752f94ab09498f47027348673afbdd8815590c [formerly 87737f790cbd6c336bae0e7d887962118066305e [formerly 3339e83db0
]]]
Former-commit-id: 68b25ab5a42b1bdc92cba6524e577fbef52ae846
Former-commit-id: 6ae904bf89fb0083aad1d0e54ec9b30f21f6821d [formerly a3257c07f6228bb2fc58694170b5ef1669e1b1da]
Former-commit-id: 1d468de53caf808014aaed4ce7c5f268bc210f12
This commit is contained in:
parent
60704c3874
commit
b6359d2bdf
63
README.md
63
README.md
@ -50,36 +50,39 @@ $ cointop
|
|||||||
|
|
||||||
List of shortcuts:
|
List of shortcuts:
|
||||||
|
|
||||||
|Key|Action|
|
Key|Action
|
||||||
|----|------|
|
----|------
|
||||||
|`<up>`|navigate up|
|
`<up>`|navigate up
|
||||||
|`<down>`|navigate down|
|
`<down>`|navigate down
|
||||||
|`<right>`|next page|
|
`<right>`|next page
|
||||||
|`<left>`|previous page|
|
`<left>`|previous page
|
||||||
|`<enter>`|visit highlighted coin on CoinMarketCap|
|
`<enter>`|visit highlighted coin on CoinMarketCap
|
||||||
|`<esc>`|alias to quit|
|
`<esc>`|alias to quit
|
||||||
|`<space>`|alias to `<enter>`|
|
`<space>`|alias to `<enter>`
|
||||||
|`<ctrl-c>`|alias to quit|
|
`<ctrl-c>`|alias to quit
|
||||||
|`<ctrl-d>`|page down|
|
`<ctrl-d>`|page down
|
||||||
|`<ctrl-n>`|alias to next page|
|
`<ctrl-n>`|alias to next page
|
||||||
|`<ctrl-u>`|page up|
|
`<ctrl-p>`|alias to previous page
|
||||||
|`<ctrl-p>`|alias to previous page|
|
`<ctrl-r>`|force refresh
|
||||||
|`<ctrl-r>`|force refresh|
|
`<ctrl-u>`|page up
|
||||||
|`1`|sort by *[1] hour change*|
|
`1`|sort by *[1] hour change*
|
||||||
|`2`|sort by *[2]4 hour change*|
|
`2`|sort by *[2]4 hour change*
|
||||||
|`7`|sort by *[7] day change*|
|
`7`|sort by *[7] day change*
|
||||||
|`a`|sort by *[a]vailable supply*|
|
`a`|sort by *[a]vailable supply*
|
||||||
|`j`|alias to `<down>`|
|
`G`|navigate to last line
|
||||||
|`k`|alias to `<up>`|
|
`h`|alias to previous page
|
||||||
|`l`|sort by *[l]ast updated*|
|
`j`|alias to `<down>`
|
||||||
|`m`|sort by *[m]arket cap*|
|
`k`|alias to `<up>`
|
||||||
|`n`|sort by *[n]ame*|
|
`l`|alias to next page
|
||||||
|`p`|sort by *[p]rice*|
|
`m`|sort by *[m]arket cap*
|
||||||
|`r`|sort by *[r]ank*|
|
`n`|sort by *[n]ame*
|
||||||
|`s`|sort by *[s]ymbol*|
|
`p`|sort by *[p]rice*
|
||||||
|`t`|sort by *[t]otal supply*|
|
`r`|sort by *[r]ank*
|
||||||
|`v`|sort by *24 hour [v]olume*|
|
`s`|sort by *[s]ymbol*
|
||||||
|`q`|[q]uit|
|
`t`|sort by *[t]otal supply*
|
||||||
|
`u`|sort by *last [u]pdated*
|
||||||
|
`v`|sort by *24 hour [v]olume*
|
||||||
|
`q`|[q]uit
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|`h`|toggle [h]elp|
|
|`h`|toggle [h]elp|
|
||||||
|
@ -21,34 +21,37 @@ func (ct *Cointop) setKeybinding(key interface{}, callback func(g *gocui.Gui, v
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ct *Cointop) keybindings(g *gocui.Gui) error {
|
func (ct *Cointop) keybindings(g *gocui.Gui) error {
|
||||||
ct.setKeybinding(gocui.KeyArrowRight, ct.nextPage)
|
|
||||||
ct.setKeybinding(gocui.KeyCtrlN, ct.nextPage)
|
|
||||||
ct.setKeybinding(gocui.KeyArrowLeft, ct.prevPage)
|
|
||||||
ct.setKeybinding(gocui.KeyCtrlP, ct.prevPage)
|
|
||||||
ct.setKeybinding(gocui.KeyArrowDown, ct.cursorDown)
|
|
||||||
ct.setKeybinding('j', ct.cursorDown)
|
|
||||||
ct.setKeybinding(gocui.KeyArrowUp, ct.cursorUp)
|
ct.setKeybinding(gocui.KeyArrowUp, ct.cursorUp)
|
||||||
ct.setKeybinding('k', ct.cursorUp)
|
ct.setKeybinding(gocui.KeyArrowDown, ct.cursorDown)
|
||||||
|
ct.setKeybinding(gocui.KeyArrowLeft, ct.prevPage)
|
||||||
|
ct.setKeybinding(gocui.KeyArrowRight, ct.nextPage)
|
||||||
|
ct.setKeybinding(gocui.KeyEnter, ct.enter)
|
||||||
|
ct.setKeybinding(gocui.KeyEsc, ct.quit)
|
||||||
|
ct.setKeybinding(gocui.KeySpace, ct.enter)
|
||||||
|
ct.setKeybinding(gocui.KeyCtrlC, ct.quit)
|
||||||
ct.setKeybinding(gocui.KeyCtrlD, ct.pageDown)
|
ct.setKeybinding(gocui.KeyCtrlD, ct.pageDown)
|
||||||
|
ct.setKeybinding(gocui.KeyCtrlN, ct.nextPage)
|
||||||
|
ct.setKeybinding(gocui.KeyCtrlP, ct.prevPage)
|
||||||
|
ct.setKeybinding(gocui.KeyCtrlR, ct.refresh)
|
||||||
ct.setKeybinding(gocui.KeyCtrlU, ct.pageUp)
|
ct.setKeybinding(gocui.KeyCtrlU, ct.pageUp)
|
||||||
ct.setKeybinding('r', ct.sortfn("rank", false))
|
|
||||||
ct.setKeybinding('n', ct.sortfn("name", true))
|
|
||||||
ct.setKeybinding('s', ct.sortfn("symbol", false))
|
|
||||||
ct.setKeybinding('p', ct.sortfn("price", true))
|
|
||||||
ct.setKeybinding('m', ct.sortfn("marketcap", true))
|
|
||||||
ct.setKeybinding('v', ct.sortfn("24hvolume", true))
|
|
||||||
ct.setKeybinding('1', ct.sortfn("1hchange", true))
|
ct.setKeybinding('1', ct.sortfn("1hchange", true))
|
||||||
ct.setKeybinding('2', ct.sortfn("24hchange", true))
|
ct.setKeybinding('2', ct.sortfn("24hchange", true))
|
||||||
ct.setKeybinding('7', ct.sortfn("7dchange", true))
|
ct.setKeybinding('7', ct.sortfn("7dchange", true))
|
||||||
ct.setKeybinding('t', ct.sortfn("totalsupply", true))
|
|
||||||
ct.setKeybinding('a', ct.sortfn("availablesupply", true))
|
ct.setKeybinding('a', ct.sortfn("availablesupply", true))
|
||||||
ct.setKeybinding('l', ct.sortfn("lastupdated", true))
|
ct.setKeybinding('G', ct.navigateLastLine)
|
||||||
ct.setKeybinding(gocui.KeyCtrlR, ct.refresh)
|
ct.setKeybinding('h', ct.prevPage)
|
||||||
ct.setKeybinding(gocui.KeyEnter, ct.enter)
|
ct.setKeybinding('j', ct.cursorDown)
|
||||||
ct.setKeybinding(gocui.KeySpace, ct.enter)
|
ct.setKeybinding('k', ct.cursorUp)
|
||||||
ct.setKeybinding(gocui.KeyCtrlC, ct.quit)
|
ct.setKeybinding('l', ct.nextPage)
|
||||||
|
ct.setKeybinding('m', ct.sortfn("marketcap", true))
|
||||||
|
ct.setKeybinding('n', ct.sortfn("name", true))
|
||||||
|
ct.setKeybinding('p', ct.sortfn("price", true))
|
||||||
|
ct.setKeybinding('r', ct.sortfn("rank", false))
|
||||||
|
ct.setKeybinding('s', ct.sortfn("symbol", false))
|
||||||
|
ct.setKeybinding('t', ct.sortfn("totalsupply", true))
|
||||||
|
ct.setKeybinding('u', ct.sortfn("lastupdated", true))
|
||||||
|
ct.setKeybinding('v', ct.sortfn("24hvolume", true))
|
||||||
ct.setKeybinding('q', ct.quit)
|
ct.setKeybinding('q', ct.quit)
|
||||||
ct.setKeybinding(gocui.KeyEsc, ct.quit)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +91,25 @@ func (ct *Cointop) pageUp(g *gocui.Gui, v *gocui.View) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ct *Cointop) navigateLastLine(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
if ct.tableview == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
ox, _ := ct.tableview.Origin()
|
||||||
|
cx, _ := ct.tableview.Cursor()
|
||||||
|
_, sy := ct.tableview.Size()
|
||||||
|
l := len(ct.coins)
|
||||||
|
k := l - sy
|
||||||
|
if err := ct.tableview.SetOrigin(ox, k); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := ct.tableview.SetCursor(cx, sy-1); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
ct.rowChanged()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (ct *Cointop) prevPage(g *gocui.Gui, v *gocui.View) error {
|
func (ct *Cointop) prevPage(g *gocui.Gui, v *gocui.View) error {
|
||||||
if (ct.page - 1) >= 0 {
|
if (ct.page - 1) >= 0 {
|
||||||
ct.page = ct.page - 1
|
ct.page = ct.page - 1
|
||||||
|
Loading…
Reference in New Issue
Block a user