| 50 | |
| 51 | |
| 52 | def _prompt_object_file(build: Path) -> Path: |
| 53 | # Look for object files in .pio/build directory |
| 54 | build_dir = build / ".pio" / "build" |
| 55 | object_files: list[Path] = list(build_dir.rglob("*.o")) |
| 56 | |
| 57 | if not object_files: |
| 58 | print("Error: No object files found", file=sys.stderr) |
| 59 | sys.exit(1) |
| 60 | |
| 61 | print("\nSelect an object file:") |
| 62 | for i, obj_file in enumerate(object_files): |
| 63 | print(f" [{i}]: {obj_file.relative_to(build_dir)}") |
| 64 | |
| 65 | while True: |
| 66 | try: |
| 67 | which = int(input("Enter the number of the object file to use: ")) |
| 68 | if 0 <= which < len(object_files): |
| 69 | return object_files[which] |
| 70 | print("Error: Invalid selection", file=sys.stderr) |
| 71 | except ValueError: |
| 72 | print("Error: Invalid input", file=sys.stderr) |
| 73 | continue |
| 74 | |
| 75 | |
| 76 | def cli() -> None: |