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/exception-in-console #215

Merged
merged 2 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Version 1.8.5 (2024-12-01)

- Fix issue with error messages not using user-defined styles. [[#215](https://github.com/ewels/rich-click/pull/215)] ([@sankarngrjn](https://github.com/sankarngrjn))

## Version 1.8.4 (2024-11-12)

- Support `rich.text.Text()` objects for `header_text`, `footer_text`, `errors_suggestion`, and `errors_epilogue`.
Expand Down
2 changes: 1 addition & 1 deletion src/rich_click/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
customisation required.
"""

__version__ = "1.8.4"
__version__ = "1.8.5"

# Import the entire click API here.
# We need to manually import these instead of `from click import *` to force
Expand Down
8 changes: 4 additions & 4 deletions src/rich_click/rich_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ def main(
if not standalone_mode:
raise
if ctx is not None:
config = ctx.help_config
formatter = ctx.make_formatter()
else:
config = self._generate_rich_help_config()
formatter = self.context_class.formatter_class(config=config, file=sys.stderr)
formatter = self.context_class.formatter_class(console=self.console, config=config, file=sys.stderr)
from rich_click.rich_help_rendering import rich_format_error

rich_format_error(e, formatter)
Expand All @@ -192,10 +192,10 @@ def main(
raise
try:
if ctx is not None:
config = ctx.help_config
formatter = ctx.make_formatter()
else:
config = self._generate_rich_help_config()
formatter = self.context_class.formatter_class(config=config)
formatter = self.context_class.formatter_class(console=self.console, config=config)
except Exception:
click.echo("Aborted!", file=sys.stderr)
else:
Expand Down