mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
28 lines
472 B
Go
28 lines
472 B
Go
package clocks
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/andrewzolotukhin/wtf/wtf"
|
|
)
|
|
|
|
func (widget *Widget) display(clocks []Clock) {
|
|
if len(clocks) == 0 {
|
|
fmt.Fprintf(widget.View, "\n%s", " no timezone data available")
|
|
return
|
|
}
|
|
|
|
str := "\n"
|
|
for idx, clock := range clocks {
|
|
str = str + fmt.Sprintf(
|
|
" [%s]%-12s %-10s %7s[white]\n",
|
|
wtf.RowColor("clocks", idx),
|
|
clock.Label,
|
|
clock.Time(),
|
|
clock.Date(),
|
|
)
|
|
}
|
|
|
|
widget.View.SetText(fmt.Sprintf("%s", str))
|
|
}
|