summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-04-09 22:11:09 -0700
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-04-09 22:11:09 -0700
commit43e6ae2ec979c04a81f7fc992c6b836f09043a92 (patch)
tree39519717b59106faa6e592079755f0f925bafc48 /examples
parent98301d03570f3e2e407c1397641bf2b04eb480ac (diff)
downloadcmd2-git-43e6ae2ec979c04a81f7fc992c6b836f09043a92.tar.gz
Deleted optparse code which had been previously deprecated in 0.8.0 release
Also: - Bumped version to 0.8.4
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/argparse_example.py27
1 files changed, 1 insertions, 26 deletions
diff --git a/examples/argparse_example.py b/examples/argparse_example.py
index fbb2b1dc..ca2173e7 100755
--- a/examples/argparse_example.py
+++ b/examples/argparse_example.py
@@ -14,8 +14,7 @@ verifying that the output produced matches the transcript.
import argparse
import sys
-from cmd2 import Cmd, options, with_argparser, with_argument_list
-from optparse import make_option
+from cmd2 import Cmd, with_argparser, with_argument_list
class CmdLineApp(Cmd):
@@ -85,30 +84,6 @@ class CmdLineApp(Cmd):
self.perror("tagg requires at least 2 arguments")
- # @options uses the python optparse module which has been deprecated
- # since 2011. Use @with_argument_parser instead, which utilizes the
- # python argparse module
- @options([make_option('-p', '--piglatin', action="store_true", help="atinLay"),
- make_option('-s', '--shout', action="store_true", help="N00B EMULATION MODE"),
- make_option('-r', '--repeat', type="int", help="output [n] times")
- ])
- def do_deprecated_speak(self, arg, opts=None):
- """Repeats what you tell me to."""
- words = []
- for word in arg:
- if opts.piglatin:
- word = '%s%say' % (word[1:], word[0])
- if opts.shout:
- arg = arg.upper()
- words.append(word)
- repetitions = opts.repeat or 1
- for i in range(min(repetitions, self.maxrepeats)):
- self.stdout.write(' '.join(words))
- self.stdout.write('\n')
- # self.stdout.write is better than "print", because Cmd can be
- # initialized with a non-standard output destination
-
-
if __name__ == '__main__':
# You can do your custom Argparse parsing here to meet your application's needs
parser = argparse.ArgumentParser(description='Process the arguments however you like.')