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:
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