Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/menu/text_input.py
diff options
context:
space:
mode:
authorDaniel <blackrabbit256@gmail.com>2022-02-12 21:47:51 +1100
committerGitHub <noreply@github.com>2022-02-12 11:47:51 +0100
commit003a35be3d908431c25f7fa9d7a7dd6beb8e0fe1 (patch)
treef7a6dd321bed2ff2a17f438847532efb6d1eda97 /archinstall/lib/menu/text_input.py
parent16716d94ebf5197f9c4c0e8cbc50709b4e6931ef (diff)
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 <girtler.daniel@gmail.com> Co-authored-by: Anton Hvornum <anton@hvornum.se>
Diffstat (limited to 'archinstall/lib/menu/text_input.py')
-rw-r--r--archinstall/lib/menu/text_input.py17
1 files changed, 17 insertions, 0 deletions
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