-
Notifications
You must be signed in to change notification settings - Fork 0
/
pick.go
29 lines (25 loc) · 1010 Bytes
/
pick.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
package main
import (
"context"
fs "cloud.google.com/go/firestore"
"github.com/reallyasi9/b1gpickem/internal/tools/btspick"
)
type makePickCmd struct {
Season int `arg:"" help:"Season to modify. If negative, the current season will be guessed based on today's date." required:""`
Week int `arg:"" help:"Week to modify. If negative, the current week will be guessed based on today's date." required:""`
Picks map[string]string `arg:"" help:"Mapping of streaker Luke name to comma-separated team other names picked by the streaker for the week. An empty team name value will clear the streaker's pick for the week."`
}
func (a *makePickCmd) Run(g *globalCmd) error {
ctx := btspick.NewContext(context.Background())
ctx.DryRun = g.DryRun
ctx.Force = g.Force
var err error
ctx.FirestoreClient, err = fs.NewClient(ctx.Context, g.ProjectID)
if err != nil {
return err
}
ctx.Season = a.Season
ctx.Week = a.Week
ctx.Picks = a.Picks
return btspick.MakePicks(ctx)
}