(boards: list[str])
| 273 | |
| 274 | |
| 275 | def choose_board_interactively(boards: list[str]) -> list[str]: |
| 276 | print("Available boards:") |
| 277 | boards = remove_duplicates(sorted(boards)) |
| 278 | for i, board in enumerate(boards): |
| 279 | print(f"[{i}]: {board}") |
| 280 | print("[all]: All boards") |
| 281 | out: list[str] = [] |
| 282 | while True: |
| 283 | try: |
| 284 | # choice = int(input("Enter the number of the board(s) you want to compile to: ")) |
| 285 | input_str = input( |
| 286 | "Enter the number of the board(s) you want to compile to, or it's name(s): " |
| 287 | ) |
| 288 | if "all" in input_str: |
| 289 | return boards |
| 290 | for board in input_str.split(","): |
| 291 | if board == "": |
| 292 | continue |
| 293 | if not board.isdigit(): |
| 294 | out.append(board) # Assume it's a board name. |
| 295 | else: |
| 296 | index = int(board) # Find the board from the index. |
| 297 | if 0 <= index < len(boards): |
| 298 | out.append(boards[index]) |
| 299 | else: |
| 300 | warnings.warn(f"invalid board index: {index}, skipping") |
| 301 | if not out: |
| 302 | print("Please try again.") |
| 303 | continue |
| 304 | return out |
| 305 | except ValueError: |
| 306 | print("Invalid input. Please enter a number.") |
| 307 | |
| 308 | |
| 309 | def resolve_example_path(example: str) -> Path: |
no test coverage detected