diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-03-13 23:33:58 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-03-13 23:33:58 -0400 |
commit | 88b45e12b0c2c9e7f8e386504f2d6808f396560b (patch) | |
tree | 66209a092dc11528f73a9cb1a991c620be09a815 /examples/pirate.py | |
parent | 23fad46d5187600d52b95125bb1629e491cb9e6f (diff) | |
download | cmd2-git-88b45e12b0c2c9e7f8e386504f2d6808f396560b.tar.gz |
First stage of attribute refactoring
The following are now arguments to cmd2.Cmd.__init__() instead of class attributes:
* allow_redirection
* multiline_commands
* terminators
* shortcuts
Added a couple read-only properties for convenience of cmd2.Cmd accessing immutable members from self.statement_parser
Diffstat (limited to 'examples/pirate.py')
-rwxr-xr-x | examples/pirate.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/examples/pirate.py b/examples/pirate.py index 32330404..a58f9a46 100755 --- a/examples/pirate.py +++ b/examples/pirate.py @@ -11,6 +11,7 @@ import argparse from colorama import Fore import cmd2 +from cmd2.constants import MULTILINE_TERMINATOR COLORS = { 'black': Fore.BLACK, @@ -28,15 +29,13 @@ class Pirate(cmd2.Cmd): """A piratical example cmd2 application involving looting and drinking.""" def __init__(self): self.default_to_shell = True - self.multiline_commands = ['sing'] - self.terminators = self.terminators + ['...'] self.songcolor = Fore.BLUE # Add stuff to shortcuts before calling base class initializer self.shortcuts.update({'~': 'sing'}) """Initialize the base class as well as this one""" - super().__init__() + super().__init__(multiline_commands=['sing'], terminators=[MULTILINE_TERMINATOR, '...']) # Make songcolor settable at runtime self.settable['songcolor'] = 'Color to ``sing`` in (black/red/green/yellow/blue/magenta/cyan/white)' |