""" Command-line argument parsing for the startpakket processing script. """ import argparse import os def validate_file_path(file_path: str) -> str: """Validate that the file exists and is an Excel file""" if not os.path.exists(file_path): raise argparse.ArgumentTypeError(f"File '{file_path}' does not exist") if not file_path.lower().endswith(('.xlsx', '.xls')): raise argparse.ArgumentTypeError(f"File '{file_path}' is not an Excel file (.xlsx or .xls)") return file_path def parse_arguments(): """Parse command line arguments""" parser = argparse.ArgumentParser( description='Process and compare student data from predeliberation and dashboard Excel files', formatter_class=argparse.RawDescriptionHelpFormatter, epilog=""" Examples: %(prog)s --predelib db.xlsx --dashboard dashboard_inschrijvingen.xlsx %(prog)s -p /path/to/predelib.xlsx -d /path/to/dashboard.xlsx --output results.json %(prog)s --predelib db.xlsx --dashboard dashboard.xlsx --verbose """ ) parser.add_argument( '--predelib', '-p', type=validate_file_path, required=True, help='Path to the predeliberation Excel file (db.xlsx)' ) parser.add_argument( '--dashboard', '-d', type=validate_file_path, required=True, help='Path to the dashboard Excel file (dashboard_inschrijvingen.xlsx)' ) parser.add_argument( '--output', '-o', type=str, help='Output file path for results (optional, prints to console if not specified)' ) parser.add_argument( '--verbose', '-v', action='store_true', help='Enable verbose logging' ) parser.add_argument( '--log-file', type=str, default='startpakket_processing.log', help='Path to log file (default: startpakket_processing.log)' ) return parser.parse_args()