diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-03-18 22:47:24 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-18 22:47:24 -0400 |
commit | 57dd827963491439e40eb5dfe20811c14ea757ff (patch) | |
tree | 9503d37d813a83a4c991d8ff8b2ed92e4a97e4ce /examples/pirate.py | |
parent | 83a28727d012ab067d18d89d3b1ce6410459f67b (diff) | |
parent | 4523bc6a9fc36ff879b6767dcd23923aa40c4c47 (diff) | |
download | cmd2-git-57dd827963491439e40eb5dfe20811c14ea757ff.tar.gz |
Merge pull request #648 from python-cmd2/attributes
Converted class attributes to instance attributes
Diffstat (limited to 'examples/pirate.py')
-rwxr-xr-x | examples/pirate.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/examples/pirate.py b/examples/pirate.py index 32330404..994ca245 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, @@ -27,17 +28,14 @@ COLORS = { class Pirate(cmd2.Cmd): """A piratical example cmd2 application involving looting and drinking.""" def __init__(self): + """Initialize the base class as well as this one""" + shortcuts = dict(self.DEFAULT_SHORTCUTS) + shortcuts.update({'~': 'sing'}) + super().__init__(multiline_commands=['sing'], terminators=[MULTILINE_TERMINATOR, '...'], shortcuts=shortcuts) + 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__() - # Make songcolor settable at runtime self.settable['songcolor'] = 'Color to ``sing`` in (black/red/green/yellow/blue/magenta/cyan/white)' |