index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | archinstall/lib/menu/text_input.py | 17 |
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 |