summaryrefslogtreecommitdiff
path: root/examples/cmd_as_argument.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2019-02-20 22:56:25 -0500
committerKevin Van Brunt <kmvanbrunt@gmail.com>2019-02-20 22:56:25 -0500
commit6cb882e3420fef1497955c9b4c7f0d8674e1557d (patch)
tree0256863a9846acd5001ab6a97b1756a54ccd3df7 /examples/cmd_as_argument.py
parent6e4d4801827559b3dc150b1dd29de482cfba2626 (diff)
downloadcmd2-git-6cb882e3420fef1497955c9b4c7f0d8674e1557d.tar.gz
Changed examples to reflect that settable doesn't need to be updated before calling init()
Diffstat (limited to 'examples/cmd_as_argument.py')
-rwxr-xr-xexamples/cmd_as_argument.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/cmd_as_argument.py b/examples/cmd_as_argument.py
index 070a34a0..dcec81c8 100755
--- a/examples/cmd_as_argument.py
+++ b/examples/cmd_as_argument.py
@@ -33,13 +33,15 @@ class CmdLineApp(cmd2.Cmd):
self.multiline_commands = ['orate']
self.maxrepeats = 3
- # Add stuff to settable and shortcuts before calling base class initializer
- self.settable['maxrepeats'] = 'max repetitions for speak command'
+ # Add stuff to shortcuts before calling base class initializer
self.shortcuts.update({'&': 'speak'})
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
super().__init__(use_ipython=False)
+ # Make maxrepeats settable at runtime
+ self.settable['maxrepeats'] = 'max repetitions for speak command'
+
speak_parser = argparse.ArgumentParser()
speak_parser.add_argument('-p', '--piglatin', action='store_true', help='atinLay')
speak_parser.add_argument('-s', '--shout', action='store_true', help='N00B EMULATION MODE')