diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2020-02-06 23:52:31 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-06 23:52:31 -0500 |
commit | 3f075900264fee32c356aac3d03b2568664ba684 (patch) | |
tree | 81a8935b7a2b8ea1c7ba429a3bde25db9c33deee /examples/initialization.py | |
parent | 3c627af7c1e22bcd0cd0a49dee05fd6b626bccc5 (diff) | |
parent | 138c28d18cee56ae09416cc00d2d461e983d90e8 (diff) | |
download | cmd2-git-3f075900264fee32c356aac3d03b2568664ba684.tar.gz |
Merge pull request #876 from python-cmd2/color_autocomplete
Added convenience enums of fg and bg colors
Diffstat (limited to 'examples/initialization.py')
-rwxr-xr-x | examples/initialization.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/initialization.py b/examples/initialization.py index c13ed137..609255f1 100755 --- a/examples/initialization.py +++ b/examples/initialization.py @@ -13,8 +13,7 @@ 10) How to make custom attributes settable at runtime """ import cmd2 -from cmd2 import style -from cmd2.ansi import FG_COLORS +from cmd2 import style, fg, bg class BasicApp(cmd2.Cmd): @@ -25,7 +24,7 @@ class BasicApp(cmd2.Cmd): startup_script='scripts/startup.txt', use_ipython=True) # Prints an intro banner once upon application startup - self.intro = style('Welcome to cmd2!', fg='red', bg='white', bold=True) + self.intro = style('Welcome to cmd2!', fg=fg.red, bg=bg.white, bold=True) # Show this as the prompt when asking for input self.prompt = 'myapp> ' @@ -44,7 +43,7 @@ class BasicApp(cmd2.Cmd): # Make echo_fg settable at runtime self.add_settable(cmd2.Settable('foreground_color', str, 'Foreground color to use with echo command', - choices=FG_COLORS)) + choices=fg.colors())) @cmd2.with_category(CUSTOM_CATEGORY) def do_intro(self, _): |