File tree Expand file tree Collapse file tree 3 files changed +11
-9
lines changed
Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 1818 Settable instance in order to be called
1919 * ** set** command now supports tab-completion of values
2020 * Removed ` cast() ` utility function
21+ * Removed ` ansi.FG_COLORS ` and ` ansi.BG_COLORS ` dictionaries
22+ * Replaced with ` ansi.fg ` and ` ansi.bg ` enums providing similar but improved functionality
2123
2224## 0.9.25 (January 26, 2020)
2325* Enhancements
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ Instructions for implementing each feature follow.
9191 class MyApp (cmd2 .Cmd ):
9292 def do_foo (self , args ):
9393 """ This docstring is the built-in help for the foo command."""
94- self .poutput(cmd2.style(' foo bar baz' , fg = ' red' ))
94+ self .poutput(cmd2.style(' foo bar baz' , fg = cmd2.fg. red))
9595 ```
9696 - By default the docstring for your ** do_foo** method is the help for the ** foo** command
9797 - NOTE : This doesn' t apply if you use one of the `argparse` decorators mentioned below
Original file line number Diff line number Diff line change 1010from typing import List
1111
1212import cmd2
13- from cmd2 import ansi
13+ from cmd2 import style , fg
1414
1515ALERTS = ["Watch as this application prints alerts and updates the prompt" ,
1616 "This will only happen when the prompt is present" ,
@@ -145,20 +145,20 @@ def _generate_colored_prompt(self) -> str:
145145 """
146146 rand_num = random .randint (1 , 20 )
147147
148- status_color = ' reset'
148+ status_color = fg . reset
149149
150150 if rand_num == 1 :
151- status_color = ' bright_red'
151+ status_color = fg . bright_red
152152 elif rand_num == 2 :
153- status_color = ' bright_yellow'
153+ status_color = fg . bright_yellow
154154 elif rand_num == 3 :
155- status_color = ' cyan'
155+ status_color = fg . cyan
156156 elif rand_num == 4 :
157- status_color = ' bright_green'
157+ status_color = fg . bright_green
158158 elif rand_num == 5 :
159- status_color = ' bright_blue'
159+ status_color = fg . bright_blue
160160
161- return ansi . style (self .visible_prompt , fg = status_color )
161+ return style (self .visible_prompt , fg = status_color )
162162
163163 def _alerter_thread_func (self ) -> None :
164164 """ Prints alerts and updates the prompt any time the prompt is showing """
You can’t perform that action at this time.
0 commit comments