Skip to content

Commit

Permalink
fix more bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
dwreeves committed Jun 10, 2024
1 parent 7662593 commit 95a480f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Version 1.8.3 (2023-06-09)

- Support `{cmd}` as an option/command group key when `python -m {cmd}` is the command_path.
- Fix yet another deprecation warning issue. (Sorry, sorry.)

## Version 1.8.2 (2023-05-14)

- Fix another deprecation warning issue.
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.2"
__version__ = "1.8.3"

# Import the entire click API here.
# We need to manually import these instead of `from click import *` to force
Expand Down
15 changes: 8 additions & 7 deletions src/rich_click/rich_help_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,14 @@ class OptionHighlighter(RegexHighlighter):
r"(?P<metavar><[^>]+>)",
]

import warnings

warnings.warn(
"OptionHighlighter is deprecated and will be removed in a future version.",
DeprecationWarning,
stacklevel=2,
)
# todo: fix
# import warnings
#
# warnings.warn(
# "OptionHighlighter is deprecated and will be removed in a future version.",
# DeprecationWarning,
# stacklevel=2,
# )

globals()["OptionHighlighter"] = OptionHighlighter

Expand Down
4 changes: 4 additions & 0 deletions src/rich_click/rich_help_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ def _resolve_groups(
paths = [cmd_name, ctx.command_path]
else:
paths = [cmd_name]
# Also handle 'python -m foo' when the user specifies a key of 'foo':
if ctx.command_path.startswith("python -m "):
extra = ctx.command_path.replace("python -m ", "", 1)
paths.append(extra)
final_groups_list: List[GroupType] = []

# Assign wildcards, but make sure we do not overwrite anything already defined.
Expand Down

0 comments on commit 95a480f

Please sign in to comment.