summaryrefslogtreecommitdiff
path: root/examples/example.py
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2019-07-05 15:05:51 -0600
committerkotfu <kotfu@kotfu.net>2019-07-05 15:05:51 -0600
commit9e64f600b65d99ea5a83051372372512be698b1b (patch)
tree7409d3646ff4a0fa349b8e71daa5959cbde342bf /examples/example.py
parent4c97ab03825151fd85a875617fde7d0534c9cb72 (diff)
downloadcmd2-git-9e64f600b65d99ea5a83051372372512be698b1b.tar.gz
Added a walkthrough of constructing a simple application to the overview
For #709
Diffstat (limited to 'examples/example.py')
-rwxr-xr-xexamples/example.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/example.py b/examples/example.py
index 24be5d5d..a62c258b 100755
--- a/examples/example.py
+++ b/examples/example.py
@@ -26,10 +26,9 @@ class CmdLineApp(cmd2.Cmd):
MUMBLE_LAST = ['right?']
def __init__(self):
- shortcuts = dict(cmd2.DEFAULT_SHORTCUTS)
+ shortcuts = cmd2.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'], shortcuts=shortcuts)
+ super().__init__(multiline_commands=['orate'], shortcuts=shortcuts)
# Make maxrepeats settable at runtime
self.maxrepeats = 3
@@ -52,7 +51,7 @@ class CmdLineApp(cmd2.Cmd):
word = word.upper()
words.append(word)
repetitions = args.repeat or 1
- for i in range(min(repetitions, self.maxrepeats)):
+ for _ in range(min(repetitions, self.maxrepeats)):
# .poutput handles newlines, and accommodates output redirection too
self.poutput(' '.join(words))