Skip to content

Use prompt_toolkit.prompt if available #1122

Description

@sedrubal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    promptInteractive input and confirmation

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions