prompt-toolkit / prompt-toolkit/python-prompt-toolkit
repl shortcut function
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.6k
- Forks
- 815
- PR merge metrics
- No merged PRs in 30d
Description
An idea from https://github.com/jonathanslenders/python-prompt-toolkit/issues/519#issuecomment-318978114 and https://github.com/jonathanslenders/python-prompt-toolkit/issues/519#issuecomment-320065017.
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 https://github.com/jonathanslenders/python-prompt-toolkit/issues/519#issuecomment-318978114).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading shortcuts.py and the two linked discussions from issue #519. Clarify the intended scope of the REPL abstraction, including callback handling, interrupts, exits, prompt numbers, and an input queue. Done means the API and supported behavior are agreed and implemented with coverage for the selected features.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100