summaryrefslogtreecommitdiff
path: root/tests/test_argparse.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-01-17 21:43:20 -0500
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-01-17 21:43:20 -0500
commit03f15696076b04a2881562a0429a435e61ffd92c (patch)
treee9d3b691b9900827f85e0b1e19f3d0355331fb9d /tests/test_argparse.py
parentb034f6d2de92a784853ddeef4e51b26148056691 (diff)
downloadcmd2-git-03f15696076b04a2881562a0429a435e61ffd92c.tar.gz
Simplified a few argparse examples and fixed some incorrect documentation
I eliminated a few "narg=1" configurations so that a single str value is returned instead of a List[str]. I also reworded some documentation which was no longer correct after the last commit which made "history command" have the same help text as "command -h" when using one of the two argparse decorators.
Diffstat (limited to 'tests/test_argparse.py')
-rw-r--r--tests/test_argparse.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/test_argparse.py b/tests/test_argparse.py
index e144514a..21e81603 100644
--- a/tests/test_argparse.py
+++ b/tests/test_argparse.py
@@ -37,12 +37,12 @@ class ArgparseApp(cmd2.Cmd):
self.stdout.write('\n')
tag_parser = argparse.ArgumentParser(description='create a html tag')
- tag_parser.add_argument('tag', nargs=1, help='tag')
+ tag_parser.add_argument('tag', help='tag')
tag_parser.add_argument('content', nargs='+', help='content to surround with tag')
@cmd2.with_argument_parser(tag_parser)
def do_tag(self, args):
- self.stdout.write('<{0}>{1}</{0}>'.format(args.tag[0], ' '.join(args.content)))
+ self.stdout.write('<{0}>{1}</{0}>'.format(args.tag, ' '.join(args.content)))
self.stdout.write('\n')
@cmd2.with_argument_list