From d2ebee4a6e55798f9d5fa41f8e2a200005b87cde Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Thu, 14 Mar 2019 00:06:19 -0400 Subject: Fixed how shortcuts are set in examples --- examples/example.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'examples/example.py') diff --git a/examples/example.py b/examples/example.py index 145ddb79..9f9c0304 100755 --- a/examples/example.py +++ b/examples/example.py @@ -27,15 +27,13 @@ class CmdLineApp(cmd2.Cmd): MUMBLE_LAST = ['right?'] def __init__(self): - self.maxrepeats = 3 - - # Add stuff to shortcuts before calling base class initializer - self.shortcuts.update({'&': 'speak'}) - + shortcuts = dict(self.DEFAULT_SHORTCUTS) + shortcuts.update({'&': 'speak'}) # Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell - super().__init__(use_ipython=False, multiline_commands=['orate']) + super().__init__(use_ipython=False, multiline_commands=['orate'], shortcuts=shortcuts) # Make maxrepeats settable at runtime + self.maxrepeats = 3 self.settable['maxrepeats'] = 'max repetitions for speak command' speak_parser = argparse.ArgumentParser() -- cgit v1.2.1