Skip to content

Fix #1460: hide prompt input if hide_input is enabled#1587

Merged
davidism merged 1 commit into
pallets:masterfrom
csr:hide-input-fix
Jun 24, 2020
Merged

Fix #1460: hide prompt input if hide_input is enabled#1587
davidism merged 1 commit into
pallets:masterfrom
csr:hide-input-fix

Conversation

@csr
Copy link
Copy Markdown
Contributor

@csr csr commented Jun 15, 2020

This PR aims to fix #1460 (prompt input would be displayed in the error message even if hide_input was enabled).

These scripts now work just fine and display Error: the value you entered was invalid if the input isn't what Click expects. Script 1:

cesaredecal$ python  -c 'import click; click.prompt("prompt", type=int, hide_input=True)'
prompt: 
Error: the value you entered was invalid

Script 2 (that asks for a numeric pin):

import click


@click.command()
@click.password_option(type=int)
def cli(password):
    pass


cli()
cesaredecal$ python hello.py
Password: 
Error: the value you entered was invalid

All tests pass.

@csr csr force-pushed the hide-input-fix branch from 85e5190 to d55b49a Compare June 19, 2020 17:37
@davidism
Copy link
Copy Markdown
Member

No tests were added because it was unclear how to test hidden prompts.

@davidism davidism merged commit 4aa8d79 into pallets:master Jun 24, 2020
@davidism davidism added this to the 8.0.0 milestone Jun 24, 2020
@csr csr deleted the hide-input-fix branch June 25, 2020 11:10
@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

Successfully merging this pull request may close these issues.

click.prompt(type=int, hide_input=True) outputs rejected input

2 participants