go-adventofcode/cmd/main.go
Brian Buller b29e554d69 Remove Debug
Also make sample program useful
2020-12-18 16:43:47 -06:00

35 lines
572 B
Go

package main
import (
"fmt"
"os"
"sort"
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)
}
var members []aoc.Member
for _, v := range l.Members {
members = append(members, v)
}
sort.Sort(aoc.ByStarsThenScore(members))
for _, v := range members {
fmt.Println(v.Name, v.Stars, v.LocalScore)
}
}