@@ -43,6 +43,7 @@ Main Features
4343- Built-in regression testing framework for your applications (transcript-based testing)
4444- Transcripts for use with built-in regression can be automatically generated from ` history -t ` or ` run_script -t `
4545- Alerts that seamlessly print while user enters text at prompt
46+ - Colored and stylized output using ` ansi.style() `
4647
4748Python 2.7 support is EOL
4849-------------------------
@@ -89,7 +90,7 @@ Instructions for implementing each feature follow.
8990 class MyApp (cmd2 .Cmd ):
9091 def do_foo (self , args ):
9192 """ This docstring is the built-in help for the foo command."""
92- print (' foo bar baz' )
93+ print (cmd2.ansi.style( ' foo bar baz' , fg = ' red ' ) )
9394 ```
9495 - By default the docstring for your ** do_foo** method is the help for the ** foo** command
9596 - NOTE : This doesn' t apply if you use one of the `argparse` decorators mentioned below
@@ -314,11 +315,10 @@ example/transcript_regex.txt:
314315
315316```text
316317# Run this transcript with "python example.py -t transcript_regex.txt"
317- # The regex for colors is because no color on Windows.
318318# The regex for editor will match whatever program you use.
319319# regexes on prompts just make the trailing space obvious
320320(Cmd) set
321- colors: / ( True | False ) /
321+ allow_ansi: Terminal
322322continuation_prompt: > / /
323323debug: False
324324echo: False
@@ -331,9 +331,7 @@ quiet: False
331331timing: False
332332```
333333
334- Note how a regular expression `/ (True | False )/ ` is used for output of the ** show color** command since
335- colored text is currently not available for cmd2 on Windows. Regular expressions can be used anywhere within a
336- transcript file simply by enclosing them within forward slashes, `/ ` .
334+ Regular expressions can be used anywhere within a transcript file simply by enclosing them within forward slashes, `/ ` .
337335
338336
339337Found a bug?
0 commit comments