diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-03-14 00:06:19 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-03-14 00:06:19 -0400 |
commit | d2ebee4a6e55798f9d5fa41f8e2a200005b87cde (patch) | |
tree | 49758371d81c2947a852aecbe6a5065d3c37013f /examples/cmd_as_argument.py | |
parent | 88b45e12b0c2c9e7f8e386504f2d6808f396560b (diff) | |
download | cmd2-git-d2ebee4a6e55798f9d5fa41f8e2a200005b87cde.tar.gz |
Fixed how shortcuts are set in examples
Diffstat (limited to 'examples/cmd_as_argument.py')
-rwxr-xr-x | examples/cmd_as_argument.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/examples/cmd_as_argument.py b/examples/cmd_as_argument.py index 48397a42..df7e1d76 100755 --- a/examples/cmd_as_argument.py +++ b/examples/cmd_as_argument.py @@ -29,15 +29,13 @@ class CmdLineApp(cmd2.Cmd): MUMBLE_LAST = ['right?'] def __init__(self): - self.allow_cli_args = False - 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) + self.allow_cli_args = False + self.maxrepeats = 3 # Make maxrepeats settable at runtime self.settable['maxrepeats'] = 'max repetitions for speak command' |