prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.28k stars 715 forks source link

Hide password instead of replacing it with a character #1783

Open Crissal1995 opened 1 year ago

Crissal1995 commented 1 year ago

Hey there, questionary user here.

I opened this issue to hide the password that an user types when using questionary.password() (a wrapper around PromptSession(is_password=True): https://github.com/tmbo/questionary/issues/321

Would be nice to specify the character to use to mask the password; right now this is *, and from a quick look it doesn't seem possible to change this behavior from an external user point of view? But correct me if I'm wrong obviously.

Line of code affected: https://github.com/prompt-toolkit/python-prompt-toolkit/blob/490cf900188df357611cdc9358256be0e5ce2e16/src/prompt_toolkit/layout/processors.py#L311

Would be nice to select either the character to use, e.g., empty string "", or just have a switch to mask the password at all, leaving the default * in case the password is not masked.