summaryrefslogtreecommitdiff
path: root/examples/pirate.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2019-03-14 00:06:19 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2019-03-14 00:06:19 -0400
commitd2ebee4a6e55798f9d5fa41f8e2a200005b87cde (patch)
tree49758371d81c2947a852aecbe6a5065d3c37013f /examples/pirate.py
parent88b45e12b0c2c9e7f8e386504f2d6808f396560b (diff)
downloadcmd2-git-d2ebee4a6e55798f9d5fa41f8e2a200005b87cde.tar.gz
Fixed how shortcuts are set in examples
Diffstat (limited to 'examples/pirate.py')
-rwxr-xr-xexamples/pirate.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/pirate.py b/examples/pirate.py
index a58f9a46..994ca245 100755
--- a/examples/pirate.py
+++ b/examples/pirate.py
@@ -28,15 +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.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__(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)'