Skip to content

Commit

Permalink
Merge pull request #215 from sankarngrjn/fix/exception-in-console
Browse files Browse the repository at this point in the history
fix/exception-in-console
  • Loading branch information
dwreeves authored Dec 1, 2024
2 parents 6c31320 + 6a397c0 commit 964019e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
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

0 comments on commit 964019e

Please sign in to comment.