show version in status bar and in help menu

pull/20/head
Miguel Mota 6 years ago
parent 22dd518200
commit b97936b54b

@ -73,7 +73,7 @@ cointop
### Homebrew (macOS)
cointop is available via [Homebrew](https://brew.sh/) for macOS:
cointop is available via [Homebrew](https://formulae.brew.sh/formula/cointop) for macOS:
```bash
brew install cointop
@ -87,9 +87,9 @@ cointop
### Flatpak (Linux)
cointop is available as a [Flatpak](https://flatpak.org/) package.
cointop is available as a [Flatpak](https://flatpak.org/) package via the [Flathub](https://flathub.org/apps/details/com.github.miguelmota.Cointop) registry.
First, add the flathub repository (if not done so already)
Add the flathub repository (if not done so already)
```bash
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

@ -48,6 +48,43 @@ var supportedcryptoconversion = map[string]string{
"ETH": "Ethereum",
}
var currencysymbols = map[string]string{
"AUD": "$",
"BRL": "R$",
"BTC": "Ƀ",
"CAD": "$",
"CFH": "₣",
"CLP": "$",
"CNY": "¥",
"CZK": "Kč",
"DKK": "Kr",
"EUR": "€",
"ETH": "Ξ",
"GBP": "£",
"HKD": "$",
"HUF": "Ft",
"IDR": "Rp.",
"ILS": "₪",
"INR": "₹",
"JPY": "¥",
"KRW": "₩",
"MXN": "$",
"MYR": "RM",
"NOK": "kr",
"NZD": "$",
"PLN": "zł",
"PHP": "₱",
"PKR": "₨",
"RUB": "Ꝑ",
"SEK": "kr",
"SGD": "S$",
"THB": "฿",
"TRY": "₺",
"TWD": "NT$",
"USD": "$",
"ZAR": "R",
}
var alphanumericcharacters = []rune{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}
func (ct *Cointop) supportedCurrencyConversions() map[string]string {

@ -7,43 +7,6 @@ import (
"github.com/miguelmota/cointop/pkg/color"
)
var currencysymbols = map[string]string{
"AUD": "$",
"BRL": "R$",
"BTC": "Ƀ",
"CAD": "$",
"CFH": "₣",
"CLP": "$",
"CNY": "¥",
"CZK": "Kč",
"DKK": "Kr",
"EUR": "€",
"ETH": "Ξ",
"GBP": "£",
"HKD": "$",
"HUF": "Ft",
"IDR": "Rp.",
"ILS": "₪",
"INR": "₹",
"JPY": "¥",
"KRW": "₩",
"MXN": "$",
"MYR": "RM",
"NOK": "kr",
"NZD": "$",
"PLN": "zł",
"PHP": "₱",
"PKR": "₨",
"RUB": "Ꝑ",
"SEK": "kr",
"SGD": "S$",
"THB": "฿",
"TRY": "₺",
"TWD": "NT$",
"USD": "$",
"ZAR": "R",
}
func (ct *Cointop) updateHeaders() {
cm := map[string]func(a ...interface{}) string{
"rank": color.Black,

@ -23,10 +23,10 @@ func (ct *Cointop) updateHelp() {
}
sort.Strings(keys)
header := color.GreenBg(fmt.Sprintf(" Help %s\n\n", pad.Left("[q] close help ", ct.maxtablewidth-10, " ")))
header := color.GreenBg(fmt.Sprintf(" Help %s\n\n", pad.Left("[q] close ", ct.maxtablewidth-10, " ")))
cnt := 0
h := ct.viewHeight(ct.helpviewname)
percol := h - 3
percol := h - 6
cols := make([][]string, percol)
for i := range cols {
cols[i] = make([]string, 20)
@ -50,8 +50,11 @@ func (ct *Cointop) updateHelp() {
}
body = fmt.Sprintf("%s%s\n", body, row)
}
body = fmt.Sprintf("%s\n", body)
content := fmt.Sprintf("%s%s", header, body)
infoline := " List of keyboard shortcuts\n\n"
versionline := pad.Left(fmt.Sprintf("v%s", ct.version()), ct.maxtablewidth-5, " ")
content := header + infoline + body + versionline
ct.update(func() {
ct.helpview.Clear()

@ -12,7 +12,10 @@ func (ct *Cointop) updateStatusbar(s string) {
currpage := ct.currentDisplayPage()
totalpages := ct.totalPages()
base := fmt.Sprintf("%sQuit %sHelp %sChart %sRange %sSearch %sConvert %sFavorite %sSave", "[Q]", "[?]", "[Enter]", "[[ ]]", "[/]", "[C]", "[F]", "[CTRL-S]")
fmt.Fprintln(ct.statusbarview, pad.Right(fmt.Sprintf("%v %sPage %v/%v %s", base, "[← →]", currpage, totalpages, s), ct.maxtablewidth, " "))
str := pad.Right(fmt.Sprintf("%v %sPage %v/%v %s", base, "[← →]", currpage, totalpages, s), ct.maxtablewidth, " ")
v := fmt.Sprintf("v%s", ct.version())
str = str[:len(str)-len(v)+2] + v
fmt.Fprintln(ct.statusbarview, str)
})
}

Loading…
Cancel
Save