-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
43 lines (34 loc) · 799 Bytes
/
main.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
38
39
40
41
42
43
package main
import (
"flag"
"fmt"
"log"
)
func main() {
onlyStarred := flag.Bool("starred", false, "Show only starred matches")
onlyToday := flag.Bool("today", false, "Show only today matches")
onlyForTeam := flag.String("team", "", "Show only for given team")
flag.Parse()
parser := NewParser(NewClientWithHeaders(map[string]string{
"User-Agent": "bot",
}))
matches, err := parser.FetchMatches()
if err != nil {
log.Fatalln(err)
}
var filter MatchesFilter = &TakeEveryMatchFilter{}
if *onlyStarred {
filter = NewStarredFilter(filter)
}
if *onlyToday {
filter = NewFilterTodayMatches(filter)
}
if len(*onlyForTeam) > 0 {
filter = NewTeamFilter(filter, *onlyForTeam)
}
for _, m := range matches {
if filter.TakeMatch(m) {
fmt.Println(m.String())
}
}
}