Skip to content

Commit

Permalink
simplify using early return
Browse files Browse the repository at this point in the history
  • Loading branch information
not-a-feature committed Apr 23, 2024
1 parent 2fd371a commit 208fa4c
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/wd_fw_update/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,19 +198,17 @@ def ask_fw_version(device, relative_urls, model, current_fw_version) -> str:

if len(fw_versions) == 1:
_logger.debug("Only one firmware to select, skipping user-promt.")
return fw_versions[0]

version = fw_versions[0]

else:
questions = [
inquirer.List(
"version",
message=f"Select the Firmware Version for {model}",
choices=fw_versions,
carousel=True,
),
]
version = inquirer.prompt(questions)["version"]
questions = [
inquirer.List(
"version",
message=f"Select the Firmware Version for {model}",
choices=fw_versions,
carousel=True,
),
]
version = inquirer.prompt(questions)["version"]

return version

Expand Down

0 comments on commit 208fa4c

Please sign in to comment.