"""
File Utilities for PA2.

Author: CS149 Instructors, JMU
Date: Spring 2025
"""
import os
import sys

WORDS = 7


def process_command_line():
    """
    Check that a valid file was passed on the command line and return its name.
    
    Returns:
        (str): The name of the file which contains the game data.
    """
    if len(sys.argv) != 2:
        print("A game data file must be passed to this program")
        sys.exit(1)
    
    if not os.path.exists(sys.argv[1]):
        err = "The game data file that was passed does not exist"
        print(err)
        sys.exit(1)
        
    return sys.argv[1]


def read_game_data(filename):
    """
    Read the file and return the words and their clues.
    
    Handle blank lines and the less than 7 words error.
    If the file contains information about more than 7 words,
    return just the first 7.
    Remove leading or trailing whitespace on each line, and
    ignore/remove excess spaces between the word and clue.
    If a word does not have a clue, put the string "No clue"
    for that word in the clues list.

    Args:
        filename (str): the name of an existing file
    
    Returns:
        (tuple): a tuple of 2 lists: the words and the clues
    """
    pass


if __name__ == "__main__":
    fn = process_command_line()
    print(read_game_data(fn))
    
    
