Skip to content

Commit 4b1c83d

Browse files
committed
cli/__init__.py: move default response option setting code out of match statement
1 parent 3a06aad commit 4b1c83d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pybricksdev/cli/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,18 +307,20 @@ async def reconnect_hub():
307307
)
308308
)
309309

310+
if (
311+
response_options.index(response)
312+
!= ResponseOptions.CHANGE_TARGET_FILE
313+
):
314+
default_response_option = response_options.index(response)
315+
310316
match response_options.index(response):
311317

312318
case ResponseOptions.RECOMPILE_RUN:
313319
with _get_script_path(args.file) as script_path:
314-
default_response_option = ResponseOptions.RECOMPILE_RUN
315320
await hub.run(script_path, wait=True)
316321

317322
case ResponseOptions.RECOMPILE_DOWNLOAD:
318323
with _get_script_path(args.file) as script_path:
319-
default_response_option = (
320-
ResponseOptions.RECOMPILE_DOWNLOAD
321-
)
322324
await hub.download(script_path)
323325

324326
case ResponseOptions.RUN_STORED:
@@ -327,7 +329,6 @@ async def reconnect_hub():
327329
"Running a stored program remotely is only supported in the hub firmware version >= v3.2.0."
328330
)
329331
else:
330-
default_response_option = ResponseOptions.RUN_STORED
331332
await hub.start_user_program()
332333
await hub._wait_for_user_program_stop()
333334

0 commit comments

Comments
 (0)