@@ -50,15 +50,15 @@ def _get(url):
5050 raise APIErrorException ('You have exceeded your allowed requests per minute/day' )
5151
5252
53- def get_live_scores (writer ):
53+ def get_live_scores (writer , use_12_hour_format ):
5454 """Gets the live scores"""
5555 req = requests .get (LIVE_URL )
5656 if req .status_code == requests .codes .ok :
5757 scores = req .json ()
5858 if len (scores ["games" ]) == 0 :
5959 click .secho ("No live action currently" , fg = "red" , bold = True )
6060 return
61- writer .live_scores (scores )
61+ writer .live_scores (scores , use_12_hour_format )
6262 else :
6363 click .secho ("There was problem getting live scores" , fg = "red" , bold = True )
6464
@@ -149,6 +149,7 @@ def get_team_players(team, writer):
149149
150150@click .command ()
151151@click .option ('--live' , is_flag = True , help = "Shows live scores from various leagues" )
152+ @click .option ('--use12hour' , is_flag = True , default = False , help = "Displays the time using 12 hour format instead of 24 (default)." )
152153@click .option ('--standings' , is_flag = True , help = "Standings for a particular league" )
153154@click .option ('--league' , '-league' , type = click .Choice (LEAGUE_IDS .keys ()),
154155 help = ("Choose the league whose fixtures you want to see. "
@@ -167,7 +168,7 @@ def get_team_players(team, writer):
167168 help = 'Output in JSON format' )
168169@click .option ('-o' , '--output-file' , default = None ,
169170 help = "Save output to a file (only if csv or json option is provided)" )
170- def main (league , time , standings , team , live , players , output_format , output_file ):
171+ def main (league , time , standings , team , live , use12hour , players , output_format , output_file ):
171172 """A CLI for live and past football scores from various football leagues"""
172173 try :
173174 if output_format == 'stdout' and output_file :
@@ -176,7 +177,7 @@ def main(league, time, standings, team, live, players, output_format, output_fil
176177 writer = get_writer (output_format , output_file )
177178
178179 if live :
179- get_live_scores (writer )
180+ get_live_scores (writer , use12hour )
180181 return
181182
182183 if standings :
0 commit comments