index : archinstall32 | |
Archlinux32 installer | gitolite user |
summaryrefslogtreecommitdiff |
author | Daniel <blackrabbit256@gmail.com> | 2022-02-12 21:47:51 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-12 11:47:51 +0100 |
commit | 003a35be3d908431c25f7fa9d7a7dd6beb8e0fe1 (patch) | |
tree | f7a6dd321bed2ff2a17f438847532efb6d1eda97 /archinstall/lib/menu/text_input.py | |
parent | 16716d94ebf5197f9c4c0e8cbc50709b4e6931ef (diff) |
-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 |