pmb.config: select default UI in case current is not available
For kernel selection we already choose a default like this, which makes sense since there's no point in having a preselected choice which doesn't exist (anymore). Also useful for some test suites where it runs "yes | pmbootstrap init" which would hang on this question. Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org> Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230607204449.84020-2-luca@z3ntu.xyz%3E
This commit is contained in:
parent
7af145fedb
commit
50ccaae76b
|
@ -146,6 +146,11 @@ def ask_for_ui(args, info):
|
|||
ui_list.pop(i)
|
||||
hidden_ui_count += 1
|
||||
|
||||
# Get default
|
||||
default = args.ui
|
||||
if default not in dict(ui_list).keys():
|
||||
default = pmb.config.defaults["ui"]
|
||||
|
||||
logging.info(f"Available user interfaces ({len(ui_list) - 1}): ")
|
||||
ui_completion_list = []
|
||||
for ui in ui_list:
|
||||
|
@ -158,7 +163,7 @@ def ask_for_ui(args, info):
|
|||
" available. See: <https://wiki.postmarketos.org/wiki/"
|
||||
"Deviceinfo_reference")
|
||||
while True:
|
||||
ret = pmb.helpers.cli.ask("User interface", None, args.ui, True,
|
||||
ret = pmb.helpers.cli.ask("User interface", None, default, True,
|
||||
complete=ui_completion_list)
|
||||
if ret in dict(ui_list).keys():
|
||||
return ret
|
||||
|
|
Loading…
Reference in New Issue