Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix default value handling in parameter help extraction when rich is installed #1120

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions typer/rich_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,11 @@ def _get_parameter_help(
# Default value
# This uses Typer's specific param._get_default_string
if isinstance(param, (TyperOption, TyperArgument)):
if param.show_default:
show_default_is_str = isinstance(param.show_default, str)
default_value = param._extract_default_help_str(ctx=ctx)
default_value = param._extract_default_help_str(ctx=ctx)
show_default_is_str = isinstance(param.show_default, str)
if show_default_is_str or (
default_value is not None and (param.show_default or ctx.show_default)
):
default_str = param._get_default_string(
ctx=ctx,
show_default_is_str=show_default_is_str,
Expand Down
Loading