diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-08-25 16:11:49 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2020-08-26 17:52:34 -0400 |
commit | 478ea83336a4d1659ad06ef365db3dc5e051e46d (patch) | |
tree | cbaff855e2d73f1d86ae1230f32770e31c62ad6b /tests_isolated | |
parent | 97c348c599d8fa963553593e5c19fb100b85e313 (diff) | |
download | cmd2-git-478ea83336a4d1659ad06ef365db3dc5e051e46d.tar.gz |
The functions cmd2 adds to Namespaces (get_statement() and get_handler()) are now
Cmd2AttributeWrapper objects named cmd2_statement and cmd2_handler. This makes it
easy to filter out which attributes in an argparse.Namespace were added by cmd2.
Diffstat (limited to 'tests_isolated')
-rw-r--r-- | tests_isolated/test_commandset/test_commandset.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests_isolated/test_commandset/test_commandset.py b/tests_isolated/test_commandset/test_commandset.py index 6856881a..939aa5b4 100644 --- a/tests_isolated/test_commandset/test_commandset.py +++ b/tests_isolated/test_commandset/test_commandset.py @@ -72,7 +72,7 @@ class CommandSetA(CommandSetBase): @cmd2.with_argparser(main_parser) def do_main(self, args: argparse.Namespace) -> None: # Call handler for whatever subcommand was selected - handler = args.get_handler() + handler = args.cmd2_handler.get() handler(args) # main -> sub @@ -309,7 +309,7 @@ class LoadableBase(cmd2.CommandSet): @cmd2.with_argparser(cut_parser) def do_cut(self, ns: argparse.Namespace): """Cut something""" - handler = ns.get_handler() + handler = ns.cmd2_handler.get() if handler is not None: # Call whatever subcommand function was selected handler(ns) @@ -330,7 +330,7 @@ class LoadableBase(cmd2.CommandSet): self._cmd.poutput('Need to cut before stirring') return - handler = ns.get_handler() + handler = ns.cmd2_handler.get() if handler is not None: # Call whatever subcommand function was selected handler(ns) @@ -345,7 +345,7 @@ class LoadableBase(cmd2.CommandSet): @cmd2.as_subcommand_to('stir', 'pasta', stir_pasta_parser) def stir_pasta(self, ns: argparse.Namespace): - handler = ns.get_handler() + handler = ns.cmd2_handler.get() if handler is not None: # Call whatever subcommand function was selected handler(ns) @@ -360,7 +360,7 @@ class LoadableBadBase(cmd2.CommandSet): def do_cut(self, ns: argparse.Namespace): """Cut something""" - handler = ns.get_handler() + handler = ns.cmd2_handler.get() if handler is not None: # Call whatever subcommand function was selected handler(ns) @@ -598,7 +598,7 @@ class AppWithSubCommands(cmd2.Cmd): @cmd2.with_argparser(cut_parser) def do_cut(self, ns: argparse.Namespace): """Cut something""" - handler = ns.get_handler() + handler = ns.cmd2_handler.get() if handler is not None: # Call whatever subcommand function was selected handler(ns) |