-
Notifications
You must be signed in to change notification settings - Fork 103
/
highlight.py
55 lines (52 loc) · 1.13 KB
/
highlight.py
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
44
45
46
47
48
49
50
51
52
53
54
55
import json
import sys
TEAMS = {
"Athletics",
"Pirates",
"Padres",
"Mariners",
"Giants",
"Cardinals",
"Rays",
"Rangers",
"Blue Jays",
"Twins",
"Phillies",
"Braves",
"White Sox",
"Marlins",
"Yankees",
"Brewers",
"Angels",
"Diamondbacks",
"Orioles",
"Red Sox",
"Cubs",
"Reds",
"Guardians",
"Rockies",
"Tigers",
"Astros",
"Royals",
"Dodgers",
"Nationals",
"Mets",
}
if __name__ == "__main__":
if len(sys.argv) == 1:
print("Supply team name(s) or -l to list")
sys.exit(1)
else:
if sys.argv[1] == "-l":
for team in TEAMS:
print(team)
else:
teams = sys.argv[1:]
if any(t not in TEAMS for t in teams):
print("Invalid team supplied!")
sys.exit(1)
with open("configs/config-default.json", "r") as default:
config = json.load(default)
config["preferred"]["teams"] = teams
with open("config.json", "w") as f:
json.dump(config, f, indent=4)