Skip to content

Commit 35108eb

Browse files
committed
Corrected a comment and some type hints.
1 parent 28729a2 commit 35108eb

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

cmd2/argparse_custom.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,7 +1261,7 @@ def _format_action_invocation(self, action: argparse.Action) -> str:
12611261
def _determine_metavar(
12621262
self,
12631263
action: argparse.Action,
1264-
default_metavar: str | tuple[str, ...],
1264+
default_metavar: str,
12651265
) -> str | tuple[str, ...]:
12661266
"""Determine what to use as the metavar value of an action."""
12671267
if action.metavar is not None:
@@ -1278,7 +1278,7 @@ def _determine_metavar(
12781278
def _metavar_formatter(
12791279
self,
12801280
action: argparse.Action,
1281-
default_metavar: str | tuple[str, ...],
1281+
default_metavar: str,
12821282
) -> Callable[[int], tuple[str, ...]]:
12831283
metavar = self._determine_metavar(action, default_metavar)
12841284

@@ -1289,7 +1289,7 @@ def format_tuple(tuple_size: int) -> tuple[str, ...]:
12891289

12901290
return format_tuple
12911291

1292-
def _format_args(self, action: argparse.Action, default_metavar: str | tuple[str, ...]) -> str:
1292+
def _format_args(self, action: argparse.Action, default_metavar: str) -> str:
12931293
"""Handle ranged nargs and make other output less verbose."""
12941294
metavar = self._determine_metavar(action, default_metavar)
12951295
metavar_formatter = self._metavar_formatter(action, default_metavar)

cmd2/rich_utils.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,11 @@ def __init__(self, file: IO[str] | None = None) -> None:
128128
elif ALLOW_STYLE == AllowStyle.NEVER:
129129
force_terminal = False
130130

131-
# Configure console defaults to treat output as plain, unstructured text.
132-
# This involves enabling soft wrapping (no automatic word-wrap) and disabling
133-
# Rich's automatic markup, emoji, and highlight processing.
134-
# While these automatic features are off by default, the console fully supports
135-
# rendering explicitly created Rich objects (e.g., Panel, Table).
136-
# Any of these default settings or other print behaviors can be overridden
137-
# in individual Console.print() calls or via cmd2's print methods.
131+
# The console's defaults are configured to handle pre-formatted text. It enables soft wrap,
132+
# which prevents automatic word-wrapping, and disables Rich's automatic processing for
133+
# markup, emoji, and highlighting. While these features are off by default, the console
134+
# can still fully render explicit Rich objects like Panels and Tables. These defaults can
135+
# be overridden in calls to Cmd2Console.print() and cmd2's print methods.
138136
super().__init__(
139137
file=file,
140138
force_terminal=force_terminal,

0 commit comments

Comments
 (0)