From 3083dee2bdba794a6623cd75becbf59c2f8d3ac0 Mon Sep 17 00:00:00 2001 From: Vuong <3168632+vuongggggg@users.noreply.github.com> Date: Sun, 4 Oct 2020 20:27:20 +0700 Subject: [PATCH] added sort shortcut for [%]holdings on portfolio --- README.md | 1 + cointop/keybindings.go | 2 ++ cointop/shortcuts.go | 1 + cointop/table_header.go | 30 +++++++++++++++--------------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 4ca58f1..baa9746 100644 --- a/README.md +++ b/README.md @@ -377,6 +377,7 @@ Key|Action t|Sort table by *[t]otal supply* u|Sort table by *last [u]pdated* v|Sort table by *24 hour [v]olume* +%|Sort table by *[%]holdings* q|Quit view $|Go to last page (vim inspired) ?|Show help| diff --git a/cointop/keybindings.go b/cointop/keybindings.go index 44589e2..e48ce93 100644 --- a/cointop/keybindings.go +++ b/cointop/keybindings.go @@ -295,6 +295,8 @@ func (ct *Cointop) Keybindings(g *gocui.Gui) error { fn = ct.Sortfn("balance", true) case "sort_column_holdings": fn = ct.Sortfn("holdings", true) + case "sort_column_percentholdings": + fn = ct.Sortfn("percentholdings", true) case "last_page": fn = ct.Keyfn(ct.LastPage) case "open_search": diff --git a/cointop/shortcuts.go b/cointop/shortcuts.go index 876aa08..506e1ba 100644 --- a/cointop/shortcuts.go +++ b/cointop/shortcuts.go @@ -67,6 +67,7 @@ func DefaultShortcuts() map[string]string { "v": "sort_column_24h_volume", "q": "quit_view", "Q": "quit_view", + "%": "sort_column_percentholdings", "$": "last_page", "?": "help", "/": "open_search", diff --git a/cointop/table_header.go b/cointop/table_header.go index 56267c8..3c3d3d7 100644 --- a/cointop/table_header.go +++ b/cointop/table_header.go @@ -30,21 +30,21 @@ func (ct *Cointop) UpdateTableHeader() { baseColor := ct.colorscheme.TableHeaderSprintf() cm := map[string]*t{ - "rank": &t{baseColor, "[r]ank", 0, 1, " "}, - "name": &t{baseColor, "[n]ame", 0, 11, " "}, - "symbol": &t{baseColor, "[s]ymbol", 4, 0, " "}, - "price": &t{baseColor, "[p]rice", 2, 0, " "}, - "holdings": &t{baseColor, "[h]oldings", 5, 0, " "}, - "balance": &t{baseColor, "[b]alance", 5, 0, " "}, - "marketcap": &t{baseColor, "[m]arket cap", 5, 0, " "}, - "24hvolume": &t{baseColor, "24H [v]olume", 3, 0, " "}, - "1hchange": &t{baseColor, "[1]H%", 5, 0, " "}, - "24hchange": &t{baseColor, "[2]4H%", 3, 0, " "}, - "7dchange": &t{baseColor, "[7]D%", 4, 0, " "}, - "totalsupply": &t{baseColor, "[t]otal supply", 7, 0, " "}, - "availablesupply": &t{baseColor, "[a]vailable supply", 0, 0, " "}, - "percentholdings": &t{baseColor, "%holdings", 2, 0, " "}, - "lastupdated": &t{baseColor, "last [u]pdated", 3, 0, " "}, + "rank": {baseColor, "[r]ank", 0, 1, " "}, + "name": {baseColor, "[n]ame", 0, 11, " "}, + "symbol": {baseColor, "[s]ymbol", 4, 0, " "}, + "price": {baseColor, "[p]rice", 2, 0, " "}, + "holdings": {baseColor, "[h]oldings", 5, 0, " "}, + "balance": {baseColor, "[b]alance", 5, 0, " "}, + "marketcap": {baseColor, "[m]arket cap", 5, 0, " "}, + "24hvolume": {baseColor, "24H [v]olume", 3, 0, " "}, + "1hchange": {baseColor, "[1]H%", 5, 0, " "}, + "24hchange": {baseColor, "[2]4H%", 3, 0, " "}, + "7dchange": {baseColor, "[7]D%", 4, 0, " "}, + "totalsupply": {baseColor, "[t]otal supply", 7, 0, " "}, + "availablesupply": {baseColor, "[a]vailable supply", 0, 0, " "}, + "percentholdings": {baseColor, "[%]holdings", 2, 0, " "}, + "lastupdated": {baseColor, "last [u]pdated", 3, 0, " "}, } for k := range cm {