Open
Description
An idea from #519 (comment) and #519 (comment).
It could be useful to have one higher level of abstraction in shortcuts.py, for the full "main loop" of a prompt REPL. Something like
def repl(execute_callback, message='', **kwargs):
while True:
try:
res = prompt(message, **kwargs)
except KeyboardInterrupt:
print("KeyboardInterrupt", file=sys.stderr)
continue
except (EOFError, SystemExit):
break
execute_callback(res) # Perhaps the callback should also be passed the cli instance
It could also support other features like keeping track of prompt numbers, or an input "queue" (see #519 (comment)).