()
| 306 | |
| 307 | |
| 308 | def main(): |
| 309 | args = sys.argv[1:] |
| 310 | if not args or args[0] in ("-h", "--help"): |
| 311 | print(__doc__) |
| 312 | sys.exit(0) |
| 313 | |
| 314 | repo_root = "." |
| 315 | tour_files = [] |
| 316 | |
| 317 | i = 0 |
| 318 | while i < len(args): |
| 319 | if args[i] == "--repo-root" and i + 1 < len(args): |
| 320 | repo_root = args[i + 1] |
| 321 | i += 2 |
| 322 | else: |
| 323 | tour_files.append(args[i]) |
| 324 | i += 1 |
| 325 | |
| 326 | if not tour_files: |
| 327 | # validate all tours in .tours/ |
| 328 | tours_dir = Path(".tours") |
| 329 | if tours_dir.exists(): |
| 330 | tour_files = [str(p) for p in sorted(tours_dir.glob("*.tour"))] |
| 331 | if not tour_files: |
| 332 | print("No .tour files found. Pass a file path or run from a repo with a .tours/ directory.") |
| 333 | sys.exit(1) |
| 334 | |
| 335 | all_passed = True |
| 336 | for tf in tour_files: |
| 337 | result = validate_tour(tf, repo_root) |
| 338 | print_report(tf, result) |
| 339 | if not result["passed"]: |
| 340 | all_passed = False |
| 341 | |
| 342 | sys.exit(0 if all_passed else 1) |
| 343 | |
| 344 | |
| 345 | if __name__ == "__main__": |
no test coverage detected