mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
handle multiple conversions per base currency
Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
parent
62e3523d29
commit
72619a99a4
@ -43,25 +43,26 @@ func (widget *Widget) Refresh() {
|
|||||||
widget.Render()
|
widget.Render()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- Unexported Functions -------------------- */
|
|
||||||
|
|
||||||
func (widget *Widget) Render() {
|
func (widget *Widget) Render() {
|
||||||
widget.Redraw(widget.content)
|
widget.Redraw(widget.content)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* -------------------- Unexported Functions -------------------- */
|
||||||
|
|
||||||
func (widget *Widget) content() (string, string, bool) {
|
func (widget *Widget) content() (string, string, bool) {
|
||||||
var out string
|
out := ""
|
||||||
|
|
||||||
if widget.err != nil {
|
if widget.err != nil {
|
||||||
out = widget.err.Error()
|
out = widget.err.Error()
|
||||||
} else {
|
} else {
|
||||||
for base, rates := range widget.settings.rates {
|
for base, rates := range widget.settings.rates {
|
||||||
out += fmt.Sprintf("[%s]1 %s[white] = ", widget.settings.common.Colors.Subheading, base)
|
prefix := fmt.Sprintf("[%s]1 %s[white] = ", widget.settings.common.Colors.Subheading, base)
|
||||||
idx := 0
|
|
||||||
for _, cur := range rates {
|
for idx, cur := range rates {
|
||||||
rate := widget.rates[base][cur]
|
rate := widget.rates[base][cur]
|
||||||
|
|
||||||
|
out += prefix
|
||||||
out += fmt.Sprintf("[%s]%f %s[white]\n", widget.CommonSettings().RowColor(idx), rate, cur)
|
out += fmt.Sprintf("[%s]%f %s[white]\n", widget.CommonSettings().RowColor(idx), rate, cur)
|
||||||
idx++
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user