GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support `show_default` string in prompts by MirrorDNA-Reflection-Protocol · Pull Request #3165 · pallets/click

Conversation

@MirrorDNA-Reflection-Protocol

@MirrorDNA-Reflection-Protocol MirrorDNA-Reflection-Protocol commented Dec 7, 2025

Copy link
Copy Markdown

Summary

Fixes #2836

When show_default is set to a string on an Option with prompt=True, the string was only used in the help text but not in the actual prompt. Now the custom string is also displayed in the prompt, matching the behavior of help text.

Before

@click.option('--name', default='default', show_default='show_default', prompt=True)

Help: --name TEXT [default: (show_default)] ✓
Prompt: Name [default]: ✗ (shows actual default, not custom string)

After

Help: --name TEXT [default: (show_default)] ✓
Prompt: Name [(show_default)]: ✓ (now shows custom string)

Changes

  1. _build_prompt(): Updated to accept str | bool for show_default. When it's a string, display it in parentheses (matching the help text format).

  2. prompt(): Updated signature to accept str | bool for show_default parameter, and updated docstring.

  3. Option.prompt_for_value(): Now passes show_default to prompt() regardless of type (previously only passed it when it was a bool).

Testing

Manually tested with the reproduction case from the issue. The prompt now correctly shows the custom show_default string.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kdeldycke

kdeldycke commented Mar 25, 2026

Copy link
Copy Markdown
Collaborator

This looks like a copy of #2837 which has been closed by the original author. I guess I can rebase it on top of stable for a future release.

#3262 on the other hand is a copy of that one.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kdeldycke kdeldycke mentioned this pull request Mar 25, 2026
Fix show_default string not displayed in prompts #3262
Closed
@kdeldycke kdeldycke added bug prompt Interactive input and confirmation labels Mar 25, 2026
@kdeldycke kdeldycke added this to the 8.3.3 milestone Mar 25, 2026
@kdeldycke kdeldycke changed the title Support show_default string in prompts Support show_default string in prompts Mar 25, 2026
@kdeldycke
kdeldycke changed the base branch from main to stable March 25, 2026 20:35
@kdeldycke

kdeldycke commented Mar 25, 2026

Copy link
Copy Markdown
Collaborator

Just added some tests on top of the original PR, including edge-cases and UNSET sentinel. Refactored the code a bit to streamline the code and reduce diff.

This PR is ready to be merged upstream on top of stable for the upcoming 8.3.3 release.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Mar 25, 2026
When prompting, use show_default as the default if its a string #2837
Closed
show_default as a string isn't used in prompts as the default shown #2836
Closed
Fix show_default string not shown in prompt (#2836) #3280
Closed
fix: show string show_default value in prompt, not just in help text #3295
Closed
Fix #2836: Use show_default string in prompts, not just help text #3290
Closed
Paul and others added 3 commits April 8, 2026 16:52
@kdeldycke
Support show_default string in prompts
197b99e
Fixes #2836

When show_default is set to a string on an Option with prompt=True,
the string was only used in the help text but not in the actual prompt.
Now the custom string is also shown in the prompt.

Changes:
- Update _build_prompt() to accept str | bool for show_default
- When show_default is a string, display it in parentheses like the help text
- Update prompt() signature to accept str | bool for show_default
- Pass show_default to prompt() regardless of type (was only passing bool)

Before:
  Help: --name TEXT  [default: (show_default)]
  Prompt: Name [default]:

After:
  Help: --name TEXT  [default: (show_default)]
  Prompt: Name [(show_default)]:
@kdeldycke
Test show_default set as string and its display in prompt
0b778d0
@kdeldycke
Preprocess default before rendering the prompt
c29e83f
@kdeldycke
kdeldycke requested review from Rowlando13 and davidism April 8, 2026 14:59
@davidism davidism closed this Apr 8, 2026
@davidism

davidism commented Apr 8, 2026

Copy link
Copy Markdown
Member

AI generated

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kdeldycke

kdeldycke commented Apr 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

@davidism : this PR may have been initially AI generated, but still fix a legitimate issue. That's why I took over it 2 weeks ago to amend and fix its slop. See the comment history.

Now that 8.3.2 has been release, I propose to start the 8.3.3 merging phase with this PR first: it is addressing an issue that a lot of AI have tried to solve in the past few weeks. So merging this will cut all the AI generated siblings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kdeldycke kdeldycke reopened this Apr 8, 2026
@davidism davidism closed this Apr 8, 2026
@davidism

davidism commented Apr 8, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

I'm not interested in cleaning up AI generated code. I don't want those contributions. I'm sorry you put time into this, but I'd rather that time be spent on creating a PR by hand rather than laundering an AI contribution

Look at the users contribution graph. It's obvious that they're not putting time into anything they're doing. I'm not interested in encouraging that behavior.

kdeldycke reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kdeldycke

kdeldycke commented Apr 8, 2026

Copy link
Copy Markdown
Collaborator

I'm not interested in cleaning up AI generated code. I don't want those contributions. I'm sorry you put time into this, but I'd rather that time be spent on creating a PR by hand rather than laundering an AI contribution

Look at the users contribution graph. It's obvious that they're not putting time into anything they're doing. I'm not interested in encouraging that behavior.

I understand. When I started working on that issue I realized we had a human-contributed solution at #2837. But the initial user deleted his forked repository so I could not rework its contribution within the #2837 PR. So I defaulted to the oldest PR which is this one. I wasn't 100% sure this PR was AI-generated so with the benefits of the doubt, and to not erase the original author commit infos, I decided to build on top of it.

I can recreate a clean PR with my modifications to fix #2836 once and for all.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@davidism

davidism commented Apr 8, 2026

Copy link
Copy Markdown
Member

You can still get the patch for a PR, even if the branch has been deleted by appending .patch to the URL. You can apply that in a new branch to re-create the PR while preserving that users credit.

kdeldycke reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kdeldycke kdeldycke mentioned this pull request Apr 9, 2026
Show default string in prompt #3328
Merged
@kdeldycke

kdeldycke commented Apr 9, 2026

Copy link
Copy Markdown
Collaborator

This PR has been superseded by #3328.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 24, 2026
@kdeldycke kdeldycke removed the prompt Interactive input and confirmation label Aug 8, 2026
@kdeldycke kdeldycke added the rejected AI Contribution rejected because of its untrustworthy AI origin label Aug 8, 2026
@kdeldycke kdeldycke removed this from the 8.3.3 milestone Aug 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@davidism davidism Awaiting requested review from davidism
@Rowlando13 Rowlando13 Awaiting requested review from Rowlando13

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

rejected AI Contribution rejected because of its untrustworthy AI origin

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@MirrorDNA-Reflection-Protocol @kdeldycke @davidism
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.