summaryrefslogtreecommitdiff
path: root/examples/pirate.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2019-03-18 22:49:42 -0400
committerGitHub <noreply@github.com>2019-03-18 22:49:42 -0400
commit2f24a8ad3eeb2fdf699d1e2a9d4f05429fe879c4 (patch)
treeb836270cf61175d1e4a434fd8cae08f0ffd998a2 /examples/pirate.py
parent96d176cc3d8198913693a42c7dd983cf69a165bd (diff)
parent57dd827963491439e40eb5dfe20811c14ea757ff (diff)
downloadcmd2-git-2f24a8ad3eeb2fdf699d1e2a9d4f05429fe879c4.tar.gz
Merge branch 'master' into load_generate_transcript
Diffstat (limited to 'examples/pirate.py')
-rwxr-xr-xexamples/pirate.py14
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)'