1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Goofin' around

This commit is contained in:
Chris Cummer 2018-04-02 21:56:59 -07:00 committed by Chris Cummer
parent 945dfc8db7
commit 46d3983cf3

View File

@ -2,7 +2,7 @@ package status
import (
"fmt"
"math/rand"
//"math/rand"
"time"
"github.com/rivo/tview"
@ -11,6 +11,7 @@ import (
type Widget struct {
wtf.BaseWidget
Current int
View *tview.TextView
}
@ -21,6 +22,7 @@ func NewWidget() *Widget {
RefreshedAt: time.Now(),
RefreshInt: 1,
},
Current: 0,
}
widget.addView()
@ -52,5 +54,13 @@ func (widget *Widget) addView() {
}
func (widget *Widget) contentFrom() string {
return fmt.Sprint(rand.Intn(100))
icons := []string{"💛", "💚", "💙", "🖤", "💜"}
next := icons[widget.Current]
widget.Current = widget.Current + 1
if widget.Current == len(icons) {
widget.Current = 0
}
return next
}