From 1a82b37b6c23490b1d9127095e3ee4f2db21a85b Mon Sep 17 00:00:00 2001 From: Eric Lin Date: Tue, 4 Aug 2020 13:46:48 -0400 Subject: Marked with_arparser_and_unknown_args deprecated and consolidated implementation as an option to with_argparser instead. --- examples/arg_print.py | 2 +- examples/modular_commands/commandset_complex.py | 2 +- examples/python_scripting.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'examples') 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 -- cgit v1.2.1