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

Function choose_board_interactively

ci/ci-compile-pio-ci-working.py:231–261  ·  view source on GitHub ↗
(boards: list[str])

Source from the content-addressed store, hash-verified

229
230
231def 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
264def resolve_example_path(example: str) -> Path:

Callers 1

mainFunction · 0.70

Calls 3

remove_duplicatesFunction · 0.70
printFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected