summaryrefslogtreecommitdiff
path: root/examples/argparse_example.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-01-20 10:08:13 -0500
committerGitHub <noreply@github.com>2018-01-20 10:08:13 -0500
commit7b564b4424accfbd7439de10a169d9b64bc599c5 (patch)
treee9d3b691b9900827f85e0b1e19f3d0355331fb9d /examples/argparse_example.py
parent91bc999d022a486334b9054859e2ef6f03ca9666 (diff)
parent03f15696076b04a2881562a0429a435e61ffd92c (diff)
downloadcmd2-git-7b564b4424accfbd7439de10a169d9b64bc599c5.tar.gz
Merge pull request #255 from python-cmd2/argparse_help
Improved how new argparse-based decorators provide help
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 ae45411c..9f6548de 100755
--- a/examples/argparse_example.py
+++ b/examples/argparse_example.py
@@ -64,14 +64,14 @@ class CmdLineApp(Cmd):
do_say = do_speak # now "say" is a synonym for "speak"
do_orate = do_speak # another synonym, but this one takes multi-line input
- tag_parser = argparse.ArgumentParser(description='create a html tag')
- tag_parser.add_argument('tag', nargs=1, help='tag')
+ tag_parser = argparse.ArgumentParser()
+ tag_parser.add_argument('tag', help='tag')
tag_parser.add_argument('content', nargs='+', help='content to surround with tag')
@with_argument_parser(tag_parser)
def do_tag(self, args):
"""create a html tag"""
- self.poutput('<{0}>{1}</{0}>'.format(args.tag[0], ' '.join(args.content)))
+ self.poutput('<{0}>{1}</{0}>'.format(args.tag, ' '.join(args.content)))
@with_argument_list