@@ -31,29 +31,21 @@ applications.
3131.. _argprint : https://github.com/python-cmd2/cmd2/blob/master/examples/arg_print.py
3232.. _decorator : https://github.com/python-cmd2/cmd2/blob/master/examples/decorator_example.py
3333
34- .. _decorators :
35-
36- Decorators provided by cmd2 for argument processing
37- ---------------------------------------------------
38-
3934``cmd2 `` provides the following decorators for assisting with parsing arguments
4035passed to commands:
4136
42- .. automethod :: cmd2.decorators.with_argparser
43- :noindex:
44- .. automethod :: cmd2.decorators.with_argparser_and_unknown_args
45- :noindex:
46- .. automethod :: cmd2.decorators.with_argument_list
47- :noindex:
37+ * :func: `cmd2.decorators.with_argparser `
38+ * :func: `cmd2.decorators.with_argparser_and_unknown_args `
39+ * :func: `cmd2.decorators.with_argument_list `
4840
4941All of these decorators accept an optional **preserve_quotes ** argument which
5042defaults to ``False ``. Setting this argument to ``True `` is useful for cases
5143where you are passing the arguments to another command which might have its own
5244argument parsing.
5345
5446
55- Using the argument parser decorator
56- -----------------------------------
47+ Argument Parsing
48+ ----------------
5749
5850For each command in the ``cmd2 `` subclass which requires argument parsing,
5951create a unique instance of ``argparse.ArgumentParser() `` which can parse the
@@ -108,8 +100,8 @@ Here's what it looks like::
108100Help Messages
109101-------------
110102
111- By default, cmd2 uses the docstring of the command method when a user asks for
112- help on the command. When you use the ``@with_argparser `` decorator, the
103+ By default, `` cmd2 `` uses the docstring of the command method when a user asks
104+ for help on the command. When you use the ``@with_argparser `` decorator, the
113105docstring for the ``do_* `` method is used to set the description for the
114106``argparse.ArgumentParser ``.
115107
@@ -215,8 +207,8 @@ Which yields:
215207.. _argparse : https://docs.python.org/3/library/argparse.html
216208
217209
218- Receiving an argument list
219- --------------------------
210+ Argument List
211+ -------------
220212
221213The default behavior of ``cmd2 `` is to pass the user input directly to your
222214``do_* `` methods as a string. The object passed to your method is actually a
@@ -265,7 +257,7 @@ argument list instead of a string::
265257 pass
266258
267259
268- Unknown positional arguments
260+ Unknown Positional Arguments
269261----------------------------
270262
271263If you want all unknown arguments to be passed to your command as a list of
@@ -295,8 +287,8 @@ Here's what it looks like::
295287
296288 ...
297289
298- Using custom argparse. Namespace
299- -------------------------------
290+ Using A Custom Namespace
291+ ------------------------
300292
301293In some cases, it may be necessary to write custom ``argparse `` code that is
302294dependent on state data of your application. To support this ability while
@@ -332,7 +324,7 @@ Subcommands are supported for commands using either the ``@with_argparser`` or
332324``@with_argparser_and_unknown_args `` decorator. The syntax for supporting them
333325is based on argparse sub-parsers.
334326
335- You may add multiple layers of subcommands for your command. Cmd2 will
327+ You may add multiple layers of subcommands for your command. `` cmd2 `` will
336328automatically traverse and tab-complete subcommands for all commands using
337329argparse.
338330
0 commit comments