Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (22 sloc) 527 Bytes
from prompt_toolkit import PromptSession
def show_help():
print("""Help
--------
quit - quit this application
exit - exit from this application
eval - evaluate
""")
s = PromptSession()
while True:
try:
cmd = s.prompt("Command: ")
if cmd in {"q", "quit", "Quit", "exit", "Exit"}:
break
elif cmd in {"help", "Help", "?"}:
show_help()
elif cmd == "eval":
print("42")
except KeyboardInterrupt:
continue
except EOFError:
break