the start of something

This commit is contained in:
Ranomier 2025-01-16 04:07:08 +01:00
parent 51ed619e2f
commit d8a73519d5

View file

@ -0,0 +1,30 @@
#/usr/bin/env python
"""
veeeeeeeeeeeery early stage of something. Nothing commited yet.
propably will be converted to a class
"""
def ask(question: str, answer_list: list, default_option: str = ""):
"""
answer_list should contain:
[
{"short": "y", "long": "yes", "description": "helpful text"},
{"short": "n", "long": "no", "description": "helpful text"}
]
"""
if default_option:
default_exists = False
for option in answer_list:
if default_option == option["short"] or default_option == option["long"]:
default_exists = True
if not default_exists:
raise NameError(f"default option: '{default_option}' not found in answer_list")
action = {
"type": question,
"content": {
"options": answer_list
}
}
# send action
# return whatever response we got from the elisp stuff