Format fixes

pull/94/head
Miguel Mota 3 years ago
parent 3c9b482708
commit 68ff8ecfb7

@ -22,7 +22,7 @@ import (
// TODO: clean up and optimize codebase
// ErrInvalidAPIChoice is error for invalid API choice
var ErrInvalidAPIChoice = errors.New("Invalid API choice")
var ErrInvalidAPIChoice = errors.New("invalid API choice")
// Views are all views in cointop
type Views struct {
@ -229,7 +229,7 @@ func NewCointop(config *Config) (*Cointop, error) {
page: 0,
perPage: int(perPage),
portfolio: &Portfolio{
Entries: make(map[string]*PortfolioEntry, 0),
Entries: make(map[string]*PortfolioEntry),
},
portfolioTableColumns: DefaultPortfolioTableHeaders,
chartHeight: 10,

@ -24,8 +24,8 @@ func (ct *Cointop) height() int {
return h
}
// viewWidth returns view width
func (ct *Cointop) viewWidth(view string) int {
// ViewWidth returns view width
func (ct *Cointop) ViewWidth(view string) int {
ct.debuglog("viewWidth()")
v, err := ct.g.View(view)
if err != nil {

@ -92,14 +92,13 @@ func (ct *Cointop) SortDesc() error {
// SortPrevCol sorts the previous column
func (ct *Cointop) SortPrevCol() error {
ct.debuglog("sortPrevCol()")
nextsortBy := ct.TableColumnOrder[0]
i := ct.GetSortColIndex()
k := i - 1
if k < 0 {
k = 0
}
nextsortBy = ct.TableColumnOrder[k]
nextsortBy := ct.TableColumnOrder[k]
ct.Sort(nextsortBy, ct.State.sortDesc, ct.State.coins, true)
ct.UpdateTable()
return nil
@ -108,7 +107,6 @@ func (ct *Cointop) SortPrevCol() error {
// SortNextCol sorts the next column
func (ct *Cointop) SortNextCol() error {
ct.debuglog("sortNextCol()")
nextsortBy := ct.TableColumnOrder[0]
l := len(ct.TableColumnOrder)
i := ct.GetSortColIndex()
k := i + 1
@ -116,7 +114,7 @@ func (ct *Cointop) SortNextCol() error {
k = l - 1
}
nextsortBy = ct.TableColumnOrder[k]
nextsortBy := ct.TableColumnOrder[k]
ct.Sort(nextsortBy, ct.State.sortDesc, ct.State.coins, true)
ct.UpdateTable()
return nil

@ -48,7 +48,7 @@ func (ct *Cointop) UpdateStatusbar(s string) error {
} else {
base := fmt.Sprintf("%s %sChart %sRange %sSearch %sConvert %s %s", helpStr, "[Enter]", "[[ ]]", "[/]", "[C]", favoritesText, portfolioText)
str := pad.Right(fmt.Sprintf("%v %sPage %v/%v %s", base, "[← →]", currpage, totalpages, s), ct.width(), " ")
v := fmt.Sprintf("%s", ct.Version())
v := ct.Version()
end := len(str) - len(v) + 2
if end > len(str) {
end = len(str)

@ -2,7 +2,6 @@ package cointop
import (
"fmt"
"math"
"net/url"
"strings"
@ -118,7 +117,7 @@ func (ct *Cointop) GetTableCoinsSlice() []*Coin {
start = 0
}
if end >= size-1 {
start = int(math.Floor(float64(start/100)) * 100)
start = int(float64(start/100) * 100)
end = size - 1
}
if start < 0 {

@ -1,14 +1,12 @@
package cointop
import (
"fmt"
"github.com/miguelmota/gocui"
)
// UpdateUI takes a callback which updates the view
func (ct *Cointop) UpdateUI(f func() error) {
ct.debuglog(fmt.Sprintf("UpdateUI()"))
ct.debuglog("UpdateUI()")
if ct.g == nil {
return

@ -14,10 +14,10 @@ import (
)
// ErrPingFailed is the error for when pinging the API fails
var ErrPingFailed = errors.New("Failed to ping")
var ErrPingFailed = errors.New("failed to ping")
// ErrNotFound is the error when the target is not found
var ErrNotFound = errors.New("Not found")
var ErrNotFound = errors.New("not found")
// Service service
type Service struct {

@ -14,10 +14,10 @@ import (
)
// ErrQuoteNotFound is the error for when a quote is not found
var ErrQuoteNotFound = errors.New("Quote not found")
var ErrQuoteNotFound = errors.New("quote not found")
// ErrPingFailed is the error for when pinging the API fails
var ErrPingFailed = errors.New("Failed to ping")
var ErrPingFailed = errors.New("failed to ping")
// Service service
type Service struct {

Loading…
Cancel
Save