diff options
| author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-10-26 14:32:28 -0400 |
|---|---|---|
| committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-10-26 14:32:33 -0400 |
| commit | 2e831b5da256e3fba269964444919ff74d718d88 (patch) | |
| tree | 1b32e20429577c3024645df685adfe7617da0340 /docs/argument_processing.rst | |
| parent | 62fdd7378f2051c3fb6c15ff8380403c8ae84c22 (diff) | |
| download | cmd2-git-2e831b5da256e3fba269964444919ff74d718d88.tar.gz | |
Improved documentation for argument parsing decorators
Also:
- Improved type hinting for these decorators
Diffstat (limited to 'docs/argument_processing.rst')
| -rw-r--r-- | docs/argument_processing.rst | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/argument_processing.rst b/docs/argument_processing.rst index 8931c60b..7e8d8f3e 100644 --- a/docs/argument_processing.rst +++ b/docs/argument_processing.rst @@ -21,6 +21,20 @@ processing decorators in your ``cmd2`` applications. .. _argprint: https://github.com/python-cmd2/cmd2/blob/master/examples/arg_print.py .. _decorator: https://github.com/python-cmd2/cmd2/blob/master/examples/decorator_example.py + +Decorators provided by cmd2 for argument processing +=================================================== +``cmd2`` provides the following decorators for assisting with parsing arguments passed to commands: + +.. automethod:: cmd2.cmd2.with_argument_list +.. automethod:: cmd2.cmd2.with_argparser +.. automethod:: cmd2.cmd2.with_argparser_and_unknown_args + +All of these decorators accept an optional **preserve_quotes** argument which defaults to ``False``. +Setting this argument to ``True`` is useful for cases where you are passing the arguments to another +command which might have its own argument parsing. + + Using the argument parser decorator =================================== @@ -402,3 +416,6 @@ See the subcommands_ and tab_autocompletion_ example to learn more about how to .. _subcommands: https://github.com/python-cmd2/cmd2/blob/master/examples/subcommands.py .. _tab_autocompletion: https://github.com/python-cmd2/cmd2/blob/master/examples/tab_autocompletion.py + + + |
