MCPcopy Create free account
hub / github.com/FastLED/FastLED / choose_board_interactively

Function choose_board_interactively

ci/ci-compile-concurrent-backup.py:275–306  ·  view source on GitHub ↗
(boards: list[str])

Source from the content-addressed store, hash-verified

273
274
275def 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
309def resolve_example_path(example: str) -> Path:

Callers 1

Calls 3

remove_duplicatesFunction · 0.70
printFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected