Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use prompt_toolkit.prompt if available #1122

Closed
sedrubal opened this issue Sep 25, 2018 · 4 comments
Closed

Use prompt_toolkit.prompt if available #1122

sedrubal opened this issue Sep 25, 2018 · 4 comments

Comments

@sedrubal
Copy link

sedrubal commented Sep 25, 2018

When prompt-toolkit is installed, you could use prompt_toolkit.prompt as drop-in-replacement of input or raw_input. This would make it possible to navigate with arrow keys and Ctrl+A and Ctrl+E and more.

Example code:

Instead of:

visible_prompt_func = raw_input

you could use this:

try:
    from prompt_toolkit import prompt as visible_prompt_func
except ImportError:
    visible_prompt_func = raw_input

Related: #181 and #173

If you want, I can make a pull request.


Click: 6.7
Python 3.7

@davidism
Copy link
Member

I'm open to reviewing something that allows customizing the prompt, if it's not possible already, but I do not want to add these sorts of optional imports that change behavior.

@sedrubal
Copy link
Author

Ok. So do you think it is ok to add prompt_toolkit as dependency and always use prompt_toolkit.prompt as visible_prompt_func?

@davidism
Copy link
Member

No, that's what I don't want.

@sedrubal
Copy link
Author

Alright. So I close this issue, as there are other issues about enhancing the prompt.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants