Skip to content

Commit

Permalink
Use show_default if its a string
Browse files Browse the repository at this point in the history
  • Loading branch information
thejcannon authored Jan 6, 2025
1 parent 8a47580 commit a898527
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/click/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2927,11 +2927,12 @@ def prompt_for_value(self, ctx: Context) -> t.Any:
if self.is_bool_flag:
return confirm(self.prompt, default)

# If show_default is set to True/False, provide this to `prompt` as well. For
# non-bool values of `show_default`, we use `prompt`'s default behavior
# If show_default is set to True/False, provide this to `prompt` as well.
prompt_kwargs: t.Any = {}
if isinstance(self.show_default, bool):
prompt_kwargs["show_default"] = self.show_default
elif isinstance(self.show_default, str):
default=show_default

return prompt(
self.prompt,
Expand Down

0 comments on commit a898527

Please sign in to comment.