39 lines
578 B
Go
39 lines
578 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
type Row struct {
|
|
Icon, Name, Value string
|
|
}
|
|
|
|
var (
|
|
rows []Row
|
|
biggestName int
|
|
)
|
|
|
|
func row(icon, name, value string) {
|
|
nameLen := len(name)
|
|
if nameLen > biggestName {
|
|
biggestName = nameLen
|
|
}
|
|
|
|
rows = append(rows, Row{icon, name, value})
|
|
}
|
|
|
|
func show() {
|
|
fmt.Println()
|
|
for i, row := range rows {
|
|
color := Colors[i%len(Colors)]
|
|
pad := strings.Repeat(" ", biggestName-len(row.Name))
|
|
|
|
fmt.Printf(
|
|
" %s%s %s%s%s %s\n",
|
|
color, row.Icon, row.Name, WhiteColor, pad, row.Value,
|
|
)
|
|
}
|
|
fmt.Println(ResetColor)
|
|
}
|