diff options
author | xNinjaKittyx <sangbumahn@gmail.com> | 2019-06-24 17:54:15 -0700 |
---|---|---|
committer | xNinjaKittyx <sangbumahn@gmail.com> | 2019-06-24 17:54:15 -0700 |
commit | e8206628eefe8234cb5118807c6f40e983c2a316 (patch) | |
tree | 455fda269bf89e5a6195059083179b8b44d51754 /examples/pirate.py | |
parent | bef07746e33da9def33d814913891384a545a95c (diff) | |
download | cmd2-git-e8206628eefe8234cb5118807c6f40e983c2a316.tar.gz |
Initial Commit for Issue 698
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)) |