diff options
author | Eric Lin <anselor@gmail.com> | 2020-08-04 13:46:48 -0400 |
---|---|---|
committer | anselor <anselor@gmail.com> | 2020-08-04 15:24:53 -0400 |
commit | 1a82b37b6c23490b1d9127095e3ee4f2db21a85b (patch) | |
tree | eb45b08c177ec9d032436af5d158a0ad065dc967 /examples | |
parent | c983abaa881a3ac6110a90194def660489b2d5cc (diff) | |
download | cmd2-git-1a82b37b6c23490b1d9127095e3ee4f2db21a85b.tar.gz |
Marked with_arparser_and_unknown_args deprecated and consolidated
implementation as an option to with_argparser instead.
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/arg_print.py | 2 | ||||
-rw-r--r-- | examples/modular_commands/commandset_complex.py | 2 | ||||
-rwxr-xr-x | examples/python_scripting.py | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/examples/arg_print.py b/examples/arg_print.py index 3f7f3815..dbf740ff 100755 --- a/examples/arg_print.py +++ b/examples/arg_print.py @@ -56,7 +56,7 @@ class ArgumentAndOptionPrinter(cmd2.Cmd): pprint_parser.add_argument('-s', '--shout', action='store_true', help='N00B EMULATION MODE') pprint_parser.add_argument('-r', '--repeat', type=int, help='output [n] times') - @cmd2.with_argparser_and_unknown_args(pprint_parser) + @cmd2.with_argparser(pprint_parser, with_unknown_args=True) def do_pprint(self, args, unknown): """Print the options and argument list this options command was called with.""" self.poutput('oprint was called with the following\n\toptions: {!r}\n\targuments: {}'.format(args, unknown)) diff --git a/examples/modular_commands/commandset_complex.py b/examples/modular_commands/commandset_complex.py index 5a031bd0..ec5a9e13 100644 --- a/examples/modular_commands/commandset_complex.py +++ b/examples/modular_commands/commandset_complex.py @@ -23,7 +23,7 @@ class CommandSetA(cmd2.CommandSet): cranberry_parser = cmd2.Cmd2ArgumentParser('cranberry') cranberry_parser.add_argument('arg1', choices=['lemonade', 'juice', 'sauce']) - @cmd2.with_argparser_and_unknown_args(cranberry_parser) + @cmd2.with_argparser(cranberry_parser, with_unknown_args=True) def do_cranberry(self, cmd: cmd2.Cmd, ns: argparse.Namespace, unknown: List[str]): cmd.poutput('Cranberry {}!!'.format(ns.arg1)) if unknown and len(unknown): diff --git a/examples/python_scripting.py b/examples/python_scripting.py index 69cfb672..6e4295d4 100755 --- a/examples/python_scripting.py +++ b/examples/python_scripting.py @@ -96,7 +96,7 @@ class CmdLineApp(cmd2.Cmd): dir_parser = argparse.ArgumentParser() dir_parser.add_argument('-l', '--long', action='store_true', help="display in long format with one item per line") - @cmd2.with_argparser_and_unknown_args(dir_parser) + @cmd2.with_argparser(dir_parser, with_unknown_args=True) def do_dir(self, args, unknown): """List contents of current directory.""" # No arguments for this command |