#!/usr/bin/env python3

from games.maze import Maze
from argparse import ArgumentParser
from importlib.metadata import version

def main():
    parser = ArgumentParser()
    parser.add_argument('--height', required=True, help='The height of the maze and mandatory argument.')
    parser.add_argument('--width',  required=True, help='The width of the maze and mandatory argument.')
    args = parser.parse_args()

    try:
        maze = Maze(int(args.height), int(args.width))
        print(maze.make())
    except ValueError:
        print("ERROR: Invalid height/width, must be >= 3.")
    except Exception as e:
        print(e)
    finally:
        print(f'The maze created by Python package py_maze_maker {version("py_maze_maker")}.')

if __name__ == "__main__":
    main()
