6060 rl_warning = "Readline features including tab completion have been disabled since no \n " \
6161 "supported version of readline was found. To resolve this, install \n " \
6262 "pyreadline on Windows or gnureadline on Mac.\n \n "
63- sys .stderr .write (ansi .style (rl_warning , ansi . WarningStyle ))
63+ sys .stderr .write (ansi .style_warning (rl_warning ))
6464else :
6565 from .rl_utils import rl_force_redisplay , readline
6666
@@ -616,7 +616,7 @@ def perror(self, msg: Any, *, end: str = '\n', apply_style: bool = True) -> None
616616 where the message text already has the desired style. Defaults to True.
617617 """
618618 if apply_style :
619- final_msg = ansi .style (msg , ansi . ErrorStyle )
619+ final_msg = ansi .style_error (msg )
620620 else :
621621 final_msg = "{}" .format (msg )
622622 self ._decolorized_write (sys .stderr , final_msg + end )
@@ -639,11 +639,11 @@ def pexcept(self, msg: Any, *, end: str = '\n', apply_style: bool = True) -> Non
639639 final_msg = "{}" .format (msg )
640640
641641 if apply_style :
642- final_msg = ansi .style (final_msg , ansi . ErrorStyle )
642+ final_msg = ansi .style_error (final_msg )
643643
644644 if not self .debug :
645645 warning = "\n To enable full traceback, run the following command: 'set debug true'"
646- final_msg += ansi .style (warning , ansi . WarningStyle )
646+ final_msg += ansi .style_warning (warning )
647647
648648 # Set apply_style to False since style has already been applied
649649 self .perror (final_msg , end = end , apply_style = False )
@@ -3246,7 +3246,7 @@ def do_run_pyscript(self, args: argparse.Namespace) -> bool:
32463246 if args .__statement__ .command == "pyscript" :
32473247 warning = ("pyscript has been renamed and will be removed in the next release, "
32483248 "please use run_pyscript instead\n " )
3249- self .perror (ansi .style (warning , ansi . WarningStyle ))
3249+ self .perror (ansi .style_warning (warning ))
32503250
32513251 return py_return
32523252
@@ -3555,7 +3555,7 @@ def _generate_transcript(self, history: List[Union[HistoryItem, str]], transcrip
35553555 # Check if all commands ran
35563556 if commands_run < len (history ):
35573557 warning = "Command {} triggered a stop and ended transcript generation early" .format (commands_run )
3558- self .perror (ansi .style (warning , ansi . WarningStyle ))
3558+ self .perror (ansi .style_warning (warning ))
35593559
35603560 # finally, we can write the transcript out to the file
35613561 try :
@@ -3675,7 +3675,7 @@ def do_run_script(self, args: argparse.Namespace) -> Optional[bool]:
36753675 if args .__statement__ .command == "load" :
36763676 warning = ("load has been renamed and will be removed in the next release, "
36773677 "please use run_script instead\n " )
3678- self .perror (ansi .style (warning , ansi . WarningStyle ))
3678+ self .perror (ansi .style_warning (warning ))
36793679
36803680 # load has been deprecated
36813681 do_load = do_run_script
@@ -3702,7 +3702,7 @@ def do__relative_run_script(self, args: argparse.Namespace) -> Optional[bool]:
37023702 if args .__statement__ .command == "_relative_load" :
37033703 warning = ("_relative_load has been renamed and will be removed in the next release, "
37043704 "please use _relative_run_script instead\n " )
3705- self .perror (ansi .style (warning , ansi . WarningStyle ))
3705+ self .perror (ansi .style_warning (warning ))
37063706
37073707 file_path = args .file_path
37083708 # NOTE: Relative path is an absolute path, it is just relative to the current script directory
@@ -3756,7 +3756,7 @@ class TestMyAppCase(Cmd2TestCase):
37563756 if test_results .wasSuccessful ():
37573757 self ._decolorized_write (sys .stderr , stream .read ())
37583758 finish_msg = '{0} transcript{1} passed in {2:.3f} seconds' .format (num_transcripts , plural , execution_time )
3759- finish_msg = ansi .style (utils .center_text (finish_msg , pad = '=' ), ansi . SuccessStyle )
3759+ finish_msg = ansi .style_success (utils .center_text (finish_msg , pad = '=' ))
37603760 self .poutput (finish_msg )
37613761 else :
37623762 # Strip off the initial traceback which isn't particularly useful for end users
0 commit comments