From 003a35be3d908431c25f7fa9d7a7dd6beb8e0fe1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sat, 12 Feb 2022 21:47:51 +1100 Subject: Fix errors on selection of additional packages (#959) * Fix errors on selection of additional packages * Fix flake8 * Added the new /groups/search/json/?name=x endpoint merged today * Fixed flake8 complaint * Forgot to do json.loads() on the HTTP request result * Update package selection * Fix flake8 Co-authored-by: Daniel Girtler Co-authored-by: Anton Hvornum --- archinstall/lib/menu/text_input.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 archinstall/lib/menu/text_input.py (limited to 'archinstall/lib/menu/text_input.py') diff --git a/archinstall/lib/menu/text_input.py b/archinstall/lib/menu/text_input.py new file mode 100644 index 00000000..05ca0f22 --- /dev/null +++ b/archinstall/lib/menu/text_input.py @@ -0,0 +1,17 @@ +import readline + + +class TextInput: + def __init__(self, prompt: str, prefilled_text=''): + self._prompt = prompt + self._prefilled_text = prefilled_text + + def _hook(self): + readline.insert_text(self._prefilled_text) + readline.redisplay() + + def run(self) -> str: + readline.set_pre_input_hook(self._hook) + result = input(self._prompt) + readline.set_pre_input_hook() + return result -- cgit v1.2.3-54-g00ecf