aboutsummaryrefslogtreecommitdiff
path: root/nba/cli.py
blob: 82c388389b267c626a48cbe981070cf4646a4746 (plain) (blame)
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
"""
This script uses argparse to parse command line arguments.

It imports the required modules and sets up a parser with basic options for demonstration purposes.
"""

import argparse
from nba import fetch_data, scores, standings


def nba() -> None:
    """
    Parse command-line arguments and display either scoreboard or standings.
    """
    parser = argparse.ArgumentParser(description="NBA Scoreboard and Standings")
    parser.add_argument("--scores", action="store_true", help="Display the scoreboard")
    parser.add_argument(
        "--standings", action="store_true", help="Display the standings"
    )
    args = parser.parse_args()

    games, ranks = fetch_data.fetch_data()

    if args.scores:
        scores.build_scoreboard(games, ranks)
    elif args.standings:
        standings.build_standings(ranks)
    else:
        print("Please specify --scores or --standings")