(boards: list[str])
| 229 | |
| 230 | |
| 231 | def choose_board_interactively(boards: list[str]) -> list[str]: |
| 232 | print("Available boards:") |
| 233 | boards = remove_duplicates(sorted(boards)) |
| 234 | for i, board in enumerate(boards): |
| 235 | print(f"[{i}]: {board}") |
| 236 | print("[all]: All boards") |
| 237 | out: list[str] = [] |
| 238 | while True: |
| 239 | try: |
| 240 | input_str = input( |
| 241 | "Enter the number of the board(s) you want to compile to, or it's name(s): " |
| 242 | ) |
| 243 | if "all" in input_str: |
| 244 | return boards |
| 245 | for board in input_str.split(","): |
| 246 | if board == "": |
| 247 | continue |
| 248 | if not board.isdigit(): |
| 249 | out.append(board) # Assume it's a board name. |
| 250 | else: |
| 251 | index = int(board) # Find the board from the index. |
| 252 | if 0 <= index < len(boards): |
| 253 | out.append(boards[index]) |
| 254 | else: |
| 255 | warnings.warn(f"invalid board index: {index}, skipping") |
| 256 | if not out: |
| 257 | print("Please try again.") |
| 258 | continue |
| 259 | return out |
| 260 | except ValueError: |
| 261 | print("Invalid input. Please enter a number.") |
| 262 | |
| 263 | |
| 264 | def resolve_example_path(example: str) -> Path: |
no test coverage detected