@@ -9,10 +9,10 @@ following for you:
991 . Passes the resulting ` argparse.Namespace ` object to your command function. The ` Namespace `
1010 includes the ` Statement ` object that was created when parsing the command line. It can be
1111 retrieved by calling ` cmd2_statement.get() ` on the ` Namespace ` .
12- 1 . Adds the usage message from the argument parser to your command.
13- 1 . Checks if the ` -h/--help ` option is present, and if so, display the help message for the command
12+ 1 . Adds the usage message from the argument parser to your command's help .
13+ 1 . Checks if the ` -h/--help ` option is present, and if so, displays the help message for the command
1414
15- These features are all provided by the ` @with_argparser ` decorator which is importable from ` cmd2 ` .
15+ These features are all provided by the ` @with_argparser ` decorator which is imported from ` cmd2 ` .
1616
1717See the
1818[ argparse_example] ( https://github.com/python-cmd2/cmd2/blob/main/examples/argparse_example.py )
@@ -49,7 +49,7 @@ argparser.add_argument('-r', '--repeat', type=int, help='output [n] times')
4949argparser.add_argument(' word' , nargs = ' ?' , help = ' word to say' )
5050
5151@with_argparser (argparser)
52- def do_speak (self , opts )
52+ def do_speak (self , opts ):
5353 """ Repeats what you tell me to."""
5454 arg = opts.word
5555 if opts.piglatin:
@@ -91,7 +91,7 @@ the `help tag` command displays:
9191``` text
9292usage: tag [-h] tag content [content ...]
9393
94- create a html tag
94+ create an HTML tag
9595
9696positional arguments:
9797 tag tag
@@ -101,13 +101,13 @@ optional arguments:
101101 -h, --help show this help message and exit
102102```
103103
104- If you would prefer you can set the ` description ` while instantiating the ` argparse.ArgumentParser `
104+ If you would prefer, you can set the ` description ` while instantiating the ` argparse.ArgumentParser `
105105and leave the docstring on your method empty:
106106
107107``` py
108108from cmd2 import Cmd2ArgumentParser, with_argparser
109109
110- argparser = Cmd2ArgumentParser(description = ' create an html tag' )
110+ argparser = Cmd2ArgumentParser(description = ' create an HTML tag' )
111111argparser.add_argument(' tag' , help = ' tag' )
112112argparser.add_argument(' content' , nargs = ' +' , help = ' content to surround with tag' )
113113@with_argparser (argparser)
@@ -121,7 +121,7 @@ Now when the user enters `help tag` they see:
121121``` text
122122usage: tag [-h] tag content [content ...]
123123
124- create an html tag
124+ create an HTML tag
125125
126126positional arguments:
127127 tag tag
@@ -136,7 +136,7 @@ To add additional text to the end of the generated help message, use the `epilog
136136``` py
137137from cmd2 import Cmd2ArgumentParser, with_argparser
138138
139- argparser = Cmd2ArgumentParser(description = ' create an html tag' ,
139+ argparser = Cmd2ArgumentParser(description = ' create an HTML tag' ,
140140 epilog = ' This command cannot generate tags with no content, like <br/>.' )
141141argparser.add_argument(' tag' , help = ' tag' )
142142argparser.add_argument(' content' , nargs = ' +' , help = ' content to surround with tag' )
@@ -151,7 +151,7 @@ Which yields:
151151``` text
152152usage: tag [-h] tag content [content ...]
153153
154- create an html tag
154+ create an HTML tag
155155
156156positional arguments:
157157 tag tag
@@ -195,7 +195,7 @@ class CmdLineApp(cmd2.Cmd):
195195 self .poutput(arg)
196196```
197197
198- If you don't want to access the additional attributes on the string passed to you ` do_* ` method you
198+ If you don't want to access the additional attributes on the string passed to your ` do_* ` method you
199199can still have ` cmd2 ` apply shell parsing rules to the user input and pass you a list of arguments
200200instead of a string. Apply the ` @with_argument_list ` decorator to those methods that should receive
201201an argument list instead of a string:
@@ -320,7 +320,7 @@ def do_foo(self, args: argparse.Namespace) -> None:
320320```
321321
322322However, if you do NOT want the custom decorator runtime behavior to occur even in the case of an
323- ` argparse ` error, then that decorator needs to go ** before** the ` arpgarse ` one, e.g.:
323+ ` argparse ` error, then that decorator needs to go ** before** the ` argparse ` one, e.g.:
324324
325325``` py
326326@my_decorator
@@ -338,9 +338,9 @@ example demonstrates both above cases in a concrete fashion.
338338` cmd2 ` argparse decorators add the following attributes to argparse Namespaces. To avoid naming
339339collisions, do not use any of the names for your argparse arguments.
340340
341- - ` cmd2_statement ` - ` cmd2.Cmd2AttributeWrapper ` object containing ` cmd2.Statement ` object that was
342- created when parsing the command line.
341+ - ` cmd2_statement ` - ` cmd2.Cmd2AttributeWrapper ` object containing the ` cmd2.Statement ` object that
342+ was created when parsing the command line.
343343- ` cmd2_handler ` - ` cmd2.Cmd2AttributeWrapper ` object containing a subcommand handler function or
344344 ` None ` if one was not set.
345- - ` __subcmd_handler__ ` - used by cmd2 to identify the handler for a subcommand created with
345+ - ` __subcmd_handler__ ` - used by cmd2 to identify the handler for a subcommand created with the
346346 ` @cmd2.as_subcommand_to ` decorator.
0 commit comments