@@ -35,7 +35,6 @@ applications.
35
35
passed to commands:
36
36
37
37
* :func: `cmd2.decorators.with_argparser `
38
- * :func: `cmd2.decorators.with_argparser_and_unknown_args `
39
38
* :func: `cmd2.decorators.with_argument_list `
40
39
41
40
All of these decorators accept an optional **preserve_quotes ** argument which
@@ -262,12 +261,12 @@ Unknown Positional Arguments
262
261
263
262
If you want all unknown arguments to be passed to your command as a list of
264
263
strings, then decorate the command method with the
265
- ``@with_argparser_and_unknown_args `` decorator.
264
+ ``@with_argparser(..., with_unknown_args=True) `` decorator.
266
265
267
266
Here's what it looks like::
268
267
269
268
import argparse
270
- from cmd2 import with_argparser_and_unknown_args
269
+ from cmd2 import with_argparser
271
270
272
271
dir_parser = argparse.ArgumentParser()
273
272
dir_parser.add_argument('-l', '--long', action='store_true', help="display in long format with one item per line")
@@ -292,9 +291,8 @@ Using A Custom Namespace
292
291
293
292
In some cases, it may be necessary to write custom ``argparse `` code that is
294
293
dependent on state data of your application. To support this ability while
295
- still allowing use of the decorators, both ``@with_argparser `` and
296
- ``@with_argparser_and_unknown_args `` have an optional argument called
297
- ``ns_provider ``.
294
+ still allowing use of the decorators, ``@with_argparser `` has an optional
295
+ argument called ``ns_provider ``.
298
296
299
297
``ns_provider `` is a Callable that accepts a ``cmd2.Cmd `` object as an argument
300
298
and returns an ``argparse.Namespace ``::
@@ -320,9 +318,8 @@ logic.
320
318
Subcommands
321
319
------------
322
320
323
- Subcommands are supported for commands using either the ``@with_argparser `` or
324
- ``@with_argparser_and_unknown_args `` decorator. The syntax for supporting them
325
- is based on argparse sub-parsers.
321
+ Subcommands are supported for commands using the ``@with_argparser `` decorator.
322
+ The syntax is based on argparse sub-parsers.
326
323
327
324
You may add multiple layers of subcommands for your command. ``cmd2 `` will
328
325
automatically traverse and tab complete subcommands for all commands using
@@ -350,8 +347,8 @@ help output.
350
347
Decorator Order
351
348
---------------
352
349
353
- If you are using custom decorators in combination with either
354
- ``@cmd2.with_argparser `` or `` @cmd2.with_argparser_and_unknown_args `` , then the
350
+ If you are using custom decorators in combination with
351
+ ``@cmd2.with_argparser ``, then the
355
352
order of your custom decorator(s) relative to the ``cmd2 `` decorator matters
356
353
when it comes to runtime behavior and ``argparse `` errors. There is nothing
357
354
``cmd2 ``-specific here, this is just a side-effect of how decorators work in
0 commit comments