forked from hpbuniat/teamr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
printr.go
37 lines (30 loc) · 1.05 KB
/
printr.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"os"
"fmt"
"github.com/olekukonko/tablewriter"
)
// printr prints the team assignment for all players per group
func printr(drawn map[int]draw) {
for number, group := range drawn {
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"Player", "Team", "League", "Att", "Mid", "Def", "Ovr", "Stars"})
for player, team := range group {
row := []string{
player,
team.name,
team.league,
fmt.Sprintf("%d", team.att),
fmt.Sprintf("%d", team.mid),
fmt.Sprintf("%d", team.def),
fmt.Sprintf("%d", team.ovr),
fmt.Sprintf("%.1f", team.stars),
}
table.Append(row)
}
fmt.Printf("\n====== Group %d\n", number)
table.Render()
fmt.Print("\n====== Teams are ready!\n")
fmt.Print("Confirm with enter or type a name to assign a new team (e.g. invalid teams according to more current stats\n\n")
}
}