@@ -229,14 +229,17 @@ def my_completer(self, text, line, begidx, endidx, arg_tokens)
229
229
ZERO_OR_MORE ,
230
230
ArgumentError ,
231
231
)
232
- from collections .abc import Callable , Iterable , Sequence
233
- from gettext import (
234
- gettext ,
232
+ from collections .abc import (
233
+ Callable ,
234
+ Iterable ,
235
+ Sequence ,
235
236
)
237
+ from gettext import gettext
236
238
from typing import (
237
239
IO ,
238
240
TYPE_CHECKING ,
239
241
Any ,
242
+ ClassVar ,
240
243
NoReturn ,
241
244
Optional ,
242
245
Protocol ,
@@ -245,6 +248,8 @@ def my_completer(self, text, line, begidx, endidx, arg_tokens)
245
248
runtime_checkable ,
246
249
)
247
250
251
+ from rich_argparse import RawTextRichHelpFormatter
252
+
248
253
from . import (
249
254
ansi ,
250
255
constants ,
@@ -991,9 +996,25 @@ def _SubParsersAction_remove_parser(self: argparse._SubParsersAction, name: str)
991
996
############################################################################################################
992
997
993
998
994
- class Cmd2HelpFormatter (argparse . RawTextHelpFormatter ):
999
+ class Cmd2HelpFormatter (RawTextRichHelpFormatter ):
995
1000
"""Custom help formatter to configure ordering of help text."""
996
1001
1002
+ # rich-argparse formats all group names with str.title().
1003
+ # Override their formatter to do nothing.
1004
+ group_name_formatter : ClassVar [Callable [[str ], str ]] = str
1005
+
1006
+ # Disable automatic highlighting in the help text.
1007
+ highlights : ClassVar [list [str ]] = []
1008
+
1009
+ # Disable markup rendering in usage, help, description, and epilog text.
1010
+ # cmd2's built-in commands do not escape opening brackets in their help text
1011
+ # and therefore rely on these settings being False. If you desire to use
1012
+ # markup in your help text, inherit from Cmd2HelpFormatter and override
1013
+ # these settings in that child class.
1014
+ usage_markup : ClassVar [bool ] = False
1015
+ help_markup : ClassVar [bool ] = False
1016
+ text_markup : ClassVar [bool ] = False
1017
+
997
1018
def _format_usage (
998
1019
self ,
999
1020
usage : Optional [str ],
0 commit comments