summaryrefslogtreecommitdiff
path: root/examples/argparse_example.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-01-22 21:07:06 -0500
committerGitHub <noreply@github.com>2018-01-22 21:07:06 -0500
commitddfd3d9a400ae81468e9abcc89fe690c30b7ec7f (patch)
tree720e9b58b694dff8f8c2513918e16a11ea24321f /examples/argparse_example.py
parent7b564b4424accfbd7439de10a169d9b64bc599c5 (diff)
parent504e3dbf9e15faf34611aae8ddabecb90e86eda5 (diff)
downloadcmd2-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-xexamples/argparse_example.py6
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)))