# src/generate_flashcard_viewer.py """ Utility script to generate a standalone HTML viewer for a given user's flashcard deck. Typically, the Streamlit app calls app.viewers.generate_flashcard_viewer_for_user directly. """ import argparse from pathlib import Path from app.viewers import generate_flashcard_viewer_for_user def main(): parser = argparse.ArgumentParser() parser.add_argument("--user", required=True, help="Username") parser.add_argument("--deck", required=True, help="Path to deck JSON") args = parser.parse_args() deck_path = Path(args.deck) if not deck_path.exists(): raise FileNotFoundError(deck_path) out_path = generate_flashcard_viewer_for_user(args.user, deck_path) print(f"Viewer written to: {out_path}") if __name__ == "__main__": main()