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

Method columnize

cmd2/cmd2.py:4483–4494  ·  view source on GitHub ↗

Display a list of single-line strings as a compact set of columns. Override of cmd's columnize() that uses the render_columns() method. The method correctly handles strings with ANSI style sequences and full-width characters (like those used in CJK languages). :para

(self, str_list: Sequence[str] | None, display_width: int = 80)

Source from the content-addressed store, hash-verified

4481 return "\n".join(rows)
4482
4483 def columnize(self, str_list: Sequence[str] | None, display_width: int = 80) -> None:
4484 """Display a list of single-line strings as a compact set of columns.
4485
4486 Override of cmd's columnize() that uses the render_columns() method.
4487 The method correctly handles strings with ANSI style sequences and
4488 full-width characters (like those used in CJK languages).
4489
4490 :param str_list: Sequence of single-line strings to display
4491 :param display_width: max number of display columns to fit into
4492 """
4493 columnized_strs = self.render_columns(str_list, display_width)
4494 self.poutput(columnized_strs)
4495
4496 @staticmethod
4497 def _build_shortcuts_parser() -> Cmd2ArgumentParser:

Callers 2

print_topicsMethod · 0.95
test_columnizeFunction · 0.80

Calls 2

render_columnsMethod · 0.95
poutputMethod · 0.95

Tested by 1

test_columnizeFunction · 0.64