Skip to content

Commit a8431f7

Browse files
committed
Added docstring to Cmd.print_to().
1 parent 5a34460 commit a8431f7

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

cmd2/cmd2.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -1211,8 +1211,21 @@ def visible_prompt(self) -> str:
12111211
return ansi.strip_style(self.prompt)
12121212

12131213
def print_to(
1214-
self, dest: Union[TextIO, IO[str]], msg: Any, *, end: str = '\n', style: Optional[Callable[[str], str]] = None
1214+
self,
1215+
dest: IO[str],
1216+
msg: Any,
1217+
*,
1218+
end: str = '\n',
1219+
style: Optional[Callable[[str], str]] = None,
12151220
) -> None:
1221+
"""
1222+
Print message to a given file object.
1223+
1224+
:param dest: the file object being written to
1225+
:param msg: object to print
1226+
:param end: string appended after the end of the message, default a newline
1227+
:param style: optional style function to format msg with (e.g. ansi.style_success)
1228+
"""
12161229
final_msg = style(msg) if style is not None else msg
12171230
try:
12181231
ansi.style_aware_write(dest, f'{final_msg}{end}')

0 commit comments

Comments
 (0)