Skip to content

Unable to allow empty str in prompt when confirmation_prompt=True #2157

@antazoey

Description

@antazoey

When you use the click.prompt() method and you specify confirmation_prompt=True, there is no way to allow the user to just hit ENTER (empty str).

passphrase = click.prompt(
    "Create Passphrase",
    hide_input=True,
    confirmation_prompt=True,
    default=""
)

Hit ENTER for the first passphrase. Then, when it asks you to confirm, hit ENTER again.
It repeats forever and never lets you exit.

After hitting ENTER the second time, I expect it to save return "" as the user's prompt answer.

Environment:

  • Python version: 3.9.7
  • Click version: 8.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions