diff options
author | Todd Leonhardt <tleonhardt@gmail.com> | 2017-06-29 12:47:11 -0400 |
---|---|---|
committer | Todd Leonhardt <tleonhardt@gmail.com> | 2017-06-29 12:47:11 -0400 |
commit | d717ea7966574dfec85bcc057f7abe5579c5c121 (patch) | |
tree | 6a639c683964eb02f385108ae783a1582a444ecd /examples/example.py | |
parent | d724287da75503c9d5197135d69ee49d8df52e77 (diff) | |
download | cmd2-git-d717ea7966574dfec85bcc057f7abe5579c5c121.tar.gz |
Refactored to replace custom StubbornDict with collections.OrderedDict
The self.settable object is now an OrderedDict instead of a custom StubbornDict.
Diffstat (limited to 'examples/example.py')
-rwxr-xr-x | examples/example.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/example.py b/examples/example.py index 68e08890..fd886a76 100755 --- a/examples/example.py +++ b/examples/example.py @@ -14,15 +14,18 @@ from cmd2 import Cmd, make_option, options, set_use_arg_list class CmdLineApp(Cmd): """ Example cmd2 application. """ - multilineCommands = ['orate'] - Cmd.shortcuts.update({'&': 'speak'}) - maxrepeats = 3 - Cmd.settable.append('maxrepeats') # Setting this true makes it run a shell command if a cmd2/cmd command doesn't exist # default_to_shell = True def __init__(self): + self.multilineCommands = ['orate'] + self.maxrepeats = 3 + + # Add stuff to settable and shortcutgs before calling base class initializer + self.settable['maxrepeats'] = 'max repetitions for speak command' + self.shortcuts.update({'&': 'speak'}) + # Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell Cmd.__init__(self, use_ipython=False) |