2020-12-18 22:36:56 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
2020-12-18 22:43:47 +00:00
|
|
|
"sort"
|
2020-12-18 22:36:56 +00:00
|
|
|
|
|
|
|
aoc "git.bullercodeworks.com/brian/go-adventofcode"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
if len(os.Args) < 3 {
|
|
|
|
fmt.Println("Usage: cmd <board id> <session id>")
|
|
|
|
}
|
|
|
|
a, err := aoc.NewAoC(os.Args[1], os.Args[2])
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
l, err := a.GetLeaderboard(2020)
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
2020-12-18 22:43:47 +00:00
|
|
|
var members []aoc.Member
|
2020-12-18 22:36:56 +00:00
|
|
|
for _, v := range l.Members {
|
2020-12-18 22:43:47 +00:00
|
|
|
members = append(members, v)
|
2020-12-18 22:36:56 +00:00
|
|
|
}
|
2020-12-18 22:43:47 +00:00
|
|
|
|
|
|
|
sort.Sort(aoc.ByStarsThenScore(members))
|
|
|
|
for _, v := range members {
|
|
|
|
fmt.Println(v.Name, v.Stars, v.LocalScore)
|
|
|
|
}
|
|
|
|
|
2020-12-18 22:36:56 +00:00
|
|
|
}
|