Skip to content
Closed
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
17 changes: 9 additions & 8 deletions cmd2/cmd2.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
Callable,
Iterable,
Mapping,
Sequence,
)
from types import (
FrameType,
Expand Down Expand Up @@ -320,10 +321,10 @@ def __init__(
include_py: bool = False,
include_ipy: bool = False,
allow_cli_args: bool = True,
transcript_files: list[str] | None = None,
transcript_files: Sequence[str] | None = None,
allow_redirection: bool = True,
multiline_commands: list[str] | None = None,
terminators: list[str] | None = None,
multiline_commands: Iterable[str] | None = None,
terminators: Iterable[str] | None = None,
shortcuts: dict[str, str] | None = None,
command_sets: Iterable[CommandSet] | None = None,
auto_load_commands: bool = False,
Expand Down Expand Up @@ -568,7 +569,7 @@ def __init__(
elif callargs:
self._startup_commands.extend(callargs)
elif transcript_files:
self._transcript_files = transcript_files
self._transcript_files = list(transcript_files)

# Set the pager(s) for use when displaying output using a pager
if sys.platform.startswith('win'):
Expand Down Expand Up @@ -2870,7 +2871,7 @@ def _run_cmdfinalization_hooks(self, stop: bool, statement: Statement | None) ->

def runcmds_plus_hooks(
self,
cmds: list[HistoryItem] | list[str],
cmds: Iterable[HistoryItem] | Iterable[str],
*,
add_to_history: bool = True,
stop_on_keyboard_interrupt: bool = False,
Expand Down Expand Up @@ -4218,7 +4219,7 @@ def do_help(self, args: argparse.Namespace) -> None:
self.perror(err_msg, style=None)
self.last_result = False

def print_topics(self, header: str, cmds: list[str] | None, cmdlen: int, maxcol: int) -> None: # noqa: ARG002
def print_topics(self, header: str, cmds: Sequence[str] | None, cmdlen: int, maxcol: int) -> None: # noqa: ARG002
"""Print groups of commands and topics in columns and an optional header.

Override of cmd's print_topics() to use Rich.
Expand Down Expand Up @@ -4307,7 +4308,7 @@ def _print_documented_command_topics(self, header: str, cmds: list[str], verbose
self.poutput(category_grid)
self.poutput()

def render_columns(self, str_list: list[str] | None, display_width: int = 80) -> str:
def render_columns(self, str_list: Sequence[str] | None, display_width: int = 80) -> str:
"""Render a list of single-line strings as a compact set of columns.

This method correctly handles strings containing ANSI style sequences and
Expand Down Expand Up @@ -4366,7 +4367,7 @@ def render_columns(self, str_list: list[str] | None, display_width: int = 80) ->

return "\n".join(rows)

def columnize(self, str_list: list[str] | None, display_width: int = 80) -> None:
def columnize(self, str_list: Sequence[str] | None, display_width: int = 80) -> None:
"""Display a list of single-line strings as a compact set of columns.

Override of cmd's columnize() that uses the render_columns() method.
Expand Down
Loading