I currently have a Python command-line interface and am attempting to convert it into a usable interface on a webpage. The general flow is the CLI asks a user to select one of a few options, then depending on their selection, it gives another set of options. At some points, the user is prompted to enter text, which is then used to produce the CLI output. The following is a simplistic example of what I mean:
def main():
action = get_action()
if action == "send":
email = get_email()
send_email(email)
elif action == "receive":
response = check_email()
print(response)
else:
print("Have a good day!")
I am using Flask to manage the webpage, but using this for the CLI has become convoluted and quite unappealing. Is there another way to go about doing this? The main issue seems to be reading user input and presenting the next option without refreshing the page.
I found other answers, such as this, but I wasn't able to get them to function properly.