@@ -124,7 +124,7 @@ import argparse
124124
125125There's a bit to unpack here, so let's walk through it. We created ` speak_parser ` , which uses the
126126[ argparse] ( https://docs.python.org/3/library/argparse.html ) module from the Python standard library
127- to parse command line input from a user. There is nothing thus far that is specific to ` cmd2 ` .
127+ to parse command line input from a user. So far, there is nothing specific to ` cmd2 ` .
128128
129129There is also a new method called ` do_speak() ` . In both
130130[ cmd] ( https://docs.python.org/3/library/cmd.html ) and ` cmd2 ` , methods that start with ` do_ ` become
@@ -137,12 +137,12 @@ Note the `cmd2.decorators.with_argparser` decorator on the `do_speak()` method.
137137 the user input doesn't meet the requirements defined by the argparser, then an error will be
138138 displayed for the user.
1391391 . It alters our ` do_speak ` method so that instead of receiving the raw user input as a parameter,
140- we receive the namespace from the argparser .
140+ we receive the namespace from the argument parser .
1411411 . It creates a help message for us based on the argparser.
142142
143143You can see in the body of the method how we use the namespace from the argparser (passed in as the
144- variable ` args ` ). We build an array of words which we will output, honoring both the ` --piglatin `
145- and ` --shout ` options.
144+ variable ` args ` ). We build a list of words which we will output, honoring both the ` --piglatin ` and
145+ ` --shout ` options.
146146
147147At the end of the method, we use our ` maxrepeats ` setting as an upper limit to the number of times
148148we will print the output.
@@ -198,9 +198,9 @@ def __init__(self):
198198
199199Shortcuts are passed to the ` cmd2 ` initializer, and if you want the built-in shortcuts of ` cmd2 ` you
200200have to pass them. These shortcuts are defined as a dictionary, with the key being the shortcut, and
201- the value containing the command. When using the default shortcuts and also adding your own, it's a
202- good idea to use the ` .update() ` method to modify the dictionary. This way if you add a shortcut
203- that happens to already be in the default set, yours will override, and you won't get any errors at
201+ the value containing the command. When using the default shortcuts and adding your own, it's a good
202+ idea to use the ` .update() ` method to modify the dictionary. This way, if you add a shortcut that
203+ happens to already be in the default set, yours will override, and you won't get any errors at
204204runtime.
205205
206206Run your app again, and type:
@@ -209,16 +209,15 @@ Run your app again, and type:
209209(Cmd) shortcuts
210210```
211211
212- to see the list of all of the shortcuts, including the one for speak that we just created.
212+ to see the list of all the shortcuts, including the one for speak that we just created.
213213
214214## Multiline Commands
215215
216- Some use cases benefit from the ability to have commands that span more than one line. For example,
217- you might want the ability for your user to type in a SQL command, which can often span lines and
218- which are terminated with a semicolon. Let's add a
219- [ multiline command] ( ../features/multiline_commands.md ) to our application. First we'll create a new
220- command called ` orate ` . This code shows both the definition of our ` speak ` command, and the ` orate `
221- command:
216+ Some use cases benefit from commands that span more than one line. For example, you might want the
217+ ability for your user to type in a SQL command, which can often span lines and which are terminated
218+ with a semicolon. Let's add a [ multiline command] ( ../features/multiline_commands.md ) to our
219+ application. First we'll create a new command called ` orate ` . This code shows both the definition of
220+ our ` speak ` command, and the ` orate ` command:
222221
223222``` py
224223@cmd2.with_argparser (speak_parser)
0 commit comments