@@ -13,15 +13,15 @@ Argument Processing
13134. Adds the usage message from the argument parser to your command.
14145. Checks if the ``-h/--help `` option is present, and if so, display the help message for the command
1515
16- These features are all provided by the ``@with_argument_parser `` decorator.
16+ These features are all provided by the ``@with_argparser `` decorator.
1717
1818Using the argument parser decorator
1919===================================
2020
2121For each command in the ``cmd2 `` subclass which requires argument parsing,
2222create an instance of ``argparse.ArgumentParser() `` which can parse the
2323input appropriately for the command. Then decorate the command method with
24- the ``@with_argument_parser `` decorator, passing the argument parser as the
24+ the ``@with_argparser `` decorator, passing the argument parser as the
2525first parameter to the decorator. This changes the second argumen to the command method, which will contain the results
2626of ``ArgumentParser.parse_args() ``.
2727
@@ -33,7 +33,7 @@ Here's what it looks like::
3333 argparser.add_argument('-r', '--repeat', type=int, help='output [n] times')
3434 argparser.add_argument('word', nargs='?', help='word to say')
3535
36- @with_argument_parser (argparser)
36+ @with_argparser (argparser)
3737 def do_speak(self, opts)
3838 """Repeats what you tell me to."""
3939 arg = opts.word
@@ -47,7 +47,7 @@ Here's what it looks like::
4747
4848.. note ::
4949
50- The ``@with_argument_parser `` decorator sets the ``prog `` variable in
50+ The ``@with_argparser `` decorator sets the ``prog `` variable in
5151 the argument parser based on the name of the method it is decorating.
5252 This will override anything you specify in ``prog `` variable when
5353 creating the argument parser.
@@ -57,14 +57,14 @@ Help Messages
5757=============
5858
5959By default, cmd2 uses the docstring of the command method when a user asks
60- for help on the command. When you use the ``@with_argument_parser ``
60+ for help on the command. When you use the ``@with_argparser ``
6161decorator, the docstring for the ``do_* `` method is used to set the description for the ``argparse.ArgumentParser `` is
6262With this code::
6363
6464 argparser = argparse.ArgumentParser()
6565 argparser.add_argument('tag', help='tag')
6666 argparser.add_argument('content', nargs='+', help='content to surround with tag')
67- @with_argument_parser (argparser)
67+ @with_argparser (argparser)
6868 def do_tag(self, args):
6969 """create a html tag"""
7070 self.stdout.write('<{0}>{1}</{0}>'.format(args.tag, ' '.join(args.content)))
@@ -92,7 +92,7 @@ docstring on your method empty::
9292 argparser = argparse.ArgumentParser(description='create an html tag')
9393 argparser.add_argument('tag', help='tag')
9494 argparser.add_argument('content', nargs='+', help='content to surround with tag')
95- @with_argument_parser (argparser)
95+ @with_argparser (argparser)
9696 def do_tag(self, args):
9797 self.stdout.write('<{0}>{1}</{0}>'.format(args.tag, ' '.join(args.content)))
9898 self.stdout.write('\n')
@@ -121,7 +121,7 @@ To add additional text to the end of the generated help message, use the ``epilo
121121 )
122122 argparser.add_argument('tag', help='tag')
123123 argparser.add_argument('content', nargs='+', help='content to surround with tag')
124- @with_argument_parser (argparser)
124+ @with_argparser (argparser)
125125 def do_tag(self, args):
126126 self.stdout.write('<{0}>{1}</{0}>'.format(args.tag, ' '.join(args.content)))
127127 self.stdout.write('\n')
@@ -190,7 +190,7 @@ Here's what it looks like::
190190
191191Sub-commands
192192============
193- Sub-commands are supported for commands using either the ``@with_argument_parser `` or
193+ Sub-commands are supported for commands using either the ``@with_argparser `` or
194194``@with_argparser_and_unknown_args `` decorator. The syntax for supporting them is based on argparse sub-parsers.
195195
196196See the subcommands _ example to learn more about how to use sub-commands in your ``cmd2 `` application.
0 commit comments