Skip to content
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
6 changes: 3 additions & 3 deletions cmd2/argparse_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ def _format_action_invocation(self, action: argparse.Action) -> str:
def _determine_metavar(
self,
action: argparse.Action,
default_metavar: str | tuple[str, ...],
default_metavar: str,
) -> str | tuple[str, ...]:
"""Determine what to use as the metavar value of an action."""
if action.metavar is not None:
Expand All @@ -1278,7 +1278,7 @@ def _determine_metavar(
def _metavar_formatter(
self,
action: argparse.Action,
default_metavar: str | tuple[str, ...],
default_metavar: str,
) -> Callable[[int], tuple[str, ...]]:
metavar = self._determine_metavar(action, default_metavar)

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

return format_tuple

def _format_args(self, action: argparse.Action, default_metavar: str | tuple[str, ...]) -> str:
def _format_args(self, action: argparse.Action, default_metavar: str) -> str:
"""Handle ranged nargs and make other output less verbose."""
metavar = self._determine_metavar(action, default_metavar)
metavar_formatter = self._metavar_formatter(action, default_metavar)
Expand Down
12 changes: 5 additions & 7 deletions cmd2/rich_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,11 @@ def __init__(self, file: IO[str] | None = None) -> None:
elif ALLOW_STYLE == AllowStyle.NEVER:
force_terminal = False

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