diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-01-22 21:07:06 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-22 21:07:06 -0500 |
commit | ddfd3d9a400ae81468e9abcc89fe690c30b7ec7f (patch) | |
tree | 720e9b58b694dff8f8c2513918e16a11ea24321f /examples/argparse_example.py | |
parent | 7b564b4424accfbd7439de10a169d9b64bc599c5 (diff) | |
parent | 504e3dbf9e15faf34611aae8ddabecb90e86eda5 (diff) | |
download | cmd2-git-ddfd3d9a400ae81468e9abcc89fe690c30b7ec7f.tar.gz |
Merge pull request #257 from python-cmd2/sub-commands
Sub-commands and automatic transcript generation
Diffstat (limited to 'examples/argparse_example.py')
-rwxr-xr-x | examples/argparse_example.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/argparse_example.py b/examples/argparse_example.py index 9f6548de..fbb2b1dc 100755 --- a/examples/argparse_example.py +++ b/examples/argparse_example.py @@ -14,7 +14,7 @@ verifying that the output produced matches the transcript. import argparse import sys -from cmd2 import Cmd, options, with_argument_parser, with_argument_list +from cmd2 import Cmd, options, with_argparser, with_argument_list from optparse import make_option @@ -47,7 +47,7 @@ class CmdLineApp(Cmd): speak_parser.add_argument('-r', '--repeat', type=int, help='output [n] times') speak_parser.add_argument('words', nargs='+', help='words to say') - @with_argument_parser(speak_parser) + @with_argparser(speak_parser) def do_speak(self, args): """Repeats what you tell me to.""" words = [] @@ -68,7 +68,7 @@ class CmdLineApp(Cmd): tag_parser.add_argument('tag', help='tag') tag_parser.add_argument('content', nargs='+', help='content to surround with tag') - @with_argument_parser(tag_parser) + @with_argparser(tag_parser) def do_tag(self, args): """create a html tag""" self.poutput('<{0}>{1}</{0}>'.format(args.tag, ' '.join(args.content))) |