diff options
Diffstat (limited to 'examples/pirate.py')
-rwxr-xr-x | examples/pirate.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/pirate.py b/examples/pirate.py index 699ee80c..57ac0b53 100755 --- a/examples/pirate.py +++ b/examples/pirate.py @@ -34,7 +34,7 @@ class Pirate(cmd2.Cmd): super().__init__(multiline_commands=['sing'], terminators=[MULTILINE_TERMINATOR, '...'], shortcuts=shortcuts) self.default_to_shell = True - self.songcolor = Fore.BLUE + self.songcolor = 'blue' # Make songcolor settable at runtime self.settable['songcolor'] = 'Color to ``sing`` in (black/red/green/yellow/blue/magenta/cyan/white)' @@ -82,8 +82,7 @@ class Pirate(cmd2.Cmd): def do_sing(self, arg): """Sing a colorful song.""" - color_escape = COLORS.get(self.songcolor, Fore.RESET) - self.poutput(arg, color=color_escape) + self.poutput(arg, fg=self.songcolor) yo_parser = argparse.ArgumentParser() yo_parser.add_argument('--ho', type=int, default=2, help="How often to chant 'ho'") @@ -101,7 +100,7 @@ class Pirate(cmd2.Cmd): if __name__ == '__main__': import sys - # Create an instance of the Pirate derived class and enter the REPL with cmdlooop(). + # Create an instance of the Pirate derived class and enter the REPL with cmdloop(). pirate = Pirate() sys_exit_code = pirate.cmdloop() print('Exiting with code: {!r}'.format(sys_exit_code)) |