MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / print_topics

Method print_topics

cmd2/cmd2.py:4367–4389  ·  view source on GitHub ↗

Print groups of commands and topics in columns and an optional header. Override of cmd's print_topics() to use Rich. :param header: string to print above commands being printed :param cmds: Sequence of topics to print :param cmdlen: unused, even by cmd's version

(self, header: str, cmds: Sequence[str] | None, cmdlen: int, maxcol: int)

Source from the content-addressed store, hash-verified

4365 return grid
4366
4367 def print_topics(self, header: str, cmds: Sequence[str] | None, cmdlen: int, maxcol: int) -> None: # noqa: ARG002
4368 """Print groups of commands and topics in columns and an optional header.
4369
4370 Override of cmd's print_topics() to use Rich.
4371
4372 :param header: string to print above commands being printed
4373 :param cmds: Sequence of topics to print
4374 :param cmdlen: unused, even by cmd's version
4375 :param maxcol: max number of display columns to fit into
4376 """
4377 if not cmds:
4378 return
4379
4380 if header:
4381 self.poutput(
4382 self._create_help_grid(header),
4383 soft_wrap=False,
4384 )
4385
4386 # Subtract 1 from maxcol to account for a one-space right margin.
4387 maxcol = min(maxcol, ru.console_width()) - 1
4388 self.columnize(cmds, maxcol)
4389 self.poutput()
4390
4391 def _print_documented_command_topics(self, header: str, commands: Sequence[str], verbose: bool) -> None:
4392 """Print topics which are documented commands, switching between verbose or traditional output."""

Callers 2

do_helpMethod · 0.95

Calls 3

poutputMethod · 0.95
_create_help_gridMethod · 0.95
columnizeMethod · 0.95

Tested by

no test coverage detected