@@ -1151,20 +1151,22 @@ def pexcept(self, msg: Any, *, end: str = '\n', apply_style: bool = True) -> Non
11511151
11521152 self .perror (final_msg , end = end , apply_style = False )
11531153
1154- def pfeedback (self , msg : Any , * , end : str = '\n ' ) -> None :
1154+ def pfeedback (self , msg : Any , * , end : str = '\n ' , apply_style : bool = True ) -> None :
11551155 """For printing nonessential feedback. Can be silenced with `quiet`.
11561156 Inclusion in redirected output is controlled by `feedback_to_output`.
11571157
11581158 :param msg: object to print
11591159 :param end: string appended after the end of the message, default a newline
1160+ :param apply_style: If True, then ansi.style_output will be applied to the message text. Set to False in cases
1161+ where the message text already has the desired style. Defaults to True.
11601162 """
11611163 if not self .quiet :
11621164 if self .feedback_to_output :
1163- self .poutput (msg , end = end )
1165+ self .poutput (msg , end = end , apply_style = apply_style )
11641166 else :
11651167 self .perror (msg , end = end , apply_style = False )
11661168
1167- def ppaged (self , msg : Any , * , end : str = '\n ' , chop : bool = False ) -> None :
1169+ def ppaged (self , msg : Any , * , end : str = '\n ' , chop : bool = False , apply_style : bool = True ) -> None :
11681170 """Print output using a pager if it would go off screen and stdout isn't currently being redirected.
11691171
11701172 Never uses a pager inside of a script (Python or text) or when output is being redirected or piped or when
@@ -1177,6 +1179,8 @@ def ppaged(self, msg: Any, *, end: str = '\n', chop: bool = False) -> None:
11771179 - chopping is ideal for displaying wide tabular data as is done in utilities like pgcli
11781180 False -> causes lines longer than the screen width to wrap to the next line
11791181 - wrapping is ideal when you want to keep users from having to use horizontal scrolling
1182+ :param apply_style: If True, then ansi.style_output will be applied to the message text. Set to False in cases
1183+ where the message text already has the desired style. Defaults to True.
11801184
11811185 WARNING: On Windows, the text always wraps regardless of what the chop argument is set to
11821186 """
@@ -1215,7 +1219,7 @@ def ppaged(self, msg: Any, *, end: str = '\n', chop: bool = False) -> None:
12151219 pipe_proc = subprocess .Popen (pager , shell = True , stdin = subprocess .PIPE )
12161220 pipe_proc .communicate (msg_str .encode ('utf-8' , 'replace' ))
12171221 else :
1218- self .poutput (msg_str , end = end )
1222+ self .poutput (msg_str , end = end , apply_style = apply_style )
12191223 except BrokenPipeError :
12201224 # This occurs if a command's output is being piped to another process and that process closes before the
12211225 # command is finished. If you would like your application to print a warning message, then set the
0 commit comments