diff options
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/colors.py | 4 | ||||
-rwxr-xr-x | examples/initialization.py | 7 | ||||
-rwxr-xr-x | examples/pirate.py | 2 |
3 files changed, 6 insertions, 7 deletions
diff --git a/examples/colors.py b/examples/colors.py index 33b17e53..1466471b 100755 --- a/examples/colors.py +++ b/examples/colors.py @@ -48,8 +48,8 @@ class CmdLineApp(cmd2.Cmd): speak_parser.add_argument('-p', '--piglatin', action='store_true', help='atinLay') speak_parser.add_argument('-s', '--shout', action='store_true', help='N00B EMULATION MODE') speak_parser.add_argument('-r', '--repeat', type=int, help='output [n] times') - speak_parser.add_argument('-f', '--fg', choices=ansi.FG_COLORS, help='foreground color to apply to output') - speak_parser.add_argument('-b', '--bg', choices=ansi.BG_COLORS, help='background color to apply to output') + speak_parser.add_argument('-f', '--fg', choices=ansi.fg.colors(), help='foreground color to apply to output') + speak_parser.add_argument('-b', '--bg', choices=ansi.bg.colors(), help='background color to apply to output') speak_parser.add_argument('-l', '--bold', action='store_true', help='bold the output') speak_parser.add_argument('-u', '--underline', action='store_true', help='underline the output') speak_parser.add_argument('words', nargs='+', help='words to say') 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, _): diff --git a/examples/pirate.py b/examples/pirate.py index acbab17c..a50f9a51 100755 --- a/examples/pirate.py +++ b/examples/pirate.py @@ -25,7 +25,7 @@ class Pirate(cmd2.Cmd): self.songcolor = 'blue' # Make songcolor settable at runtime - self.add_settable(cmd2.Settable('songcolor', str, 'Color to ``sing``', choices=cmd2.ansi.FG_COLORS)) + self.add_settable(cmd2.Settable('songcolor', str, 'Color to ``sing``', choices=cmd2.ansi.fg.colors())) # prompts and defaults self.gold = 0 |