Skip to content
Merged
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
14 changes: 7 additions & 7 deletions cmd2/cmd2.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ def visible_prompt(self) -> str:
"""
return ansi.strip_ansi(self.prompt)

def poutput(self, msg: Any, *, end: str = '\n') -> None:
def poutput(self, msg: Any = '', *, end: str = '\n') -> None:
"""Print message to self.stdout and appends a newline by default

Also handles BrokenPipeError exceptions for when a commands's output has
Expand All @@ -449,8 +449,8 @@ def poutput(self, msg: Any, *, end: str = '\n') -> None:
if self.broken_pipe_warning:
sys.stderr.write(self.broken_pipe_warning)

@staticmethod
def perror(msg: Any, *, end: str = '\n', apply_style: bool = True) -> None:
# noinspection PyMethodMayBeStatic
def perror(self, msg: Any = '', *, end: str = '\n', apply_style: bool = True) -> None:
"""Print message to sys.stderr

:param msg: message to print (anything convertible to a str with '{}'.format() is OK)
Expand All @@ -464,8 +464,8 @@ def perror(msg: Any, *, end: str = '\n', apply_style: bool = True) -> None:
final_msg = "{}".format(msg)
ansi.ansi_aware_write(sys.stderr, final_msg + end)

def pwarning(self, msg: Any, *, end: str = '\n', apply_style: bool = True) -> None:
"""Like perror, but applies ansi.style_warning by default
def pwarning(self, msg: Any = '', *, end: str = '\n', apply_style: bool = True) -> None:
"""Wraps perror, but applies ansi.style_warning by default

:param msg: message to print (anything convertible to a str with '{}'.format() is OK)
:param end: string appended after the end of the message, default a newline
Expand Down Expand Up @@ -1397,7 +1397,7 @@ def complete(self, text: str, state: int) -> Optional[str]:

except Exception as e:
# Insert a newline so the exception doesn't print in the middle of the command line being tab completed
self.perror('\n', end='')
self.perror()
self.pexcept(e)
return None

Expand Down Expand Up @@ -2770,7 +2770,7 @@ def select(self, opts: Union[str, List[str], List[Tuple[Any, Optional[str]]]],
response = self.read_input(prompt)
except EOFError:
response = ''
self.poutput('\n', end='')
self.poutput()
except KeyboardInterrupt as ex:
self.poutput('^C')
raise ex
Expand Down