Skip to content

Fix #2836: Use show_default string in prompts, not just help text#3290

Closed
MuraveyApp wants to merge 1 commit intopallets:mainfrom
MuraveyApp:fix/issue-2836
Closed

Fix #2836: Use show_default string in prompts, not just help text#3290
MuraveyApp wants to merge 1 commit intopallets:mainfrom
MuraveyApp:fix/issue-2836

Conversation

@MuraveyApp
Copy link
Copy Markdown

Summary

Fixes #2836 — When show_default is a string, the help text correctly displayed it but the interactive prompt showed the raw default value instead.

Changes

  • src/click/core.py: prompt_for_value() now passes string show_default to prompt() (was only passing booleans)
  • src/click/termui.py: _build_prompt() and prompt() accept show_default: bool | str — string values are displayed in brackets

Tests

Added 2 tests in tests/test_termui.py:

  • test_show_default_string_in_prompt — custom string appears in prompt
  • test_show_default_true_shows_actual_default_in_prompt — True still works

All existing tests pass.

Context

This issue has been open for 1+ year. Resolved with assistance from OwlMind — an autonomous AI coding agent.

When show_default is a string, the help text correctly displayed it
but the interactive prompt showed the raw default value instead.

Resolved with assistance from OwlMind (https://owlmind.dev)
@davidism davidism closed this Mar 29, 2026
@kdeldycke kdeldycke added bug f:prompt feature: prompt for input invalid labels Mar 30, 2026
@kdeldycke kdeldycke added this to the 8.3.3 milestone Mar 30, 2026
@kdeldycke
Copy link
Copy Markdown
Collaborator

This is already addressed by #3165

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug f:prompt feature: prompt for input invalid

Projects

None yet

Development

Successfully merging this pull request may close these issues.

show_default as a string isn't used in prompts as the default shown

3 participants