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

Function _prompt_object_file

ci/util/tools.py:93–122  ·  view source on GitHub ↗
(build: Path)

Source from the content-addressed store, hash-verified

91
92
93def _prompt_object_file(build: Path) -> Path:
94 # Look for object files in .pio/build directory
95 build_dir = build / ".pio" / "build"
96 object_files: list[Path] = []
97
98 # Walk through build directory to find .o files
99 for root, _, files in os.walk(build_dir):
100 for file in files:
101 if file.endswith(".o") and "FrameworkArduino" not in file:
102 full_path = Path(root) / file
103 if "FrameworkArduino" not in full_path.parts:
104 object_files.append(full_path)
105
106 if not object_files:
107 print("Error: No object files found", file=sys.stderr)
108 sys.exit(1)
109
110 print("\nSelect an object file:")
111 for i, obj_file in enumerate(object_files):
112 print(f" [{i}]: {obj_file.relative_to(build_dir)}")
113
114 while True:
115 try:
116 which = int(input("Enter the number of the object file to use: "))
117 if 0 <= which < len(object_files):
118 return object_files[which]
119 print("Error: Invalid selection", file=sys.stderr)
120 except ValueError:
121 print("Error: Invalid input", file=sys.stderr)
122 continue
123
124
125def cli() -> None:

Callers 1

cliFunction · 0.70

Calls 2

printFunction · 0.50
appendMethod · 0.45

Tested by

no test coverage detected