diff options
Diffstat (limited to 'examples/modular_subcommands.py')
-rw-r--r-- | examples/modular_subcommands.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/modular_subcommands.py b/examples/modular_subcommands.py index 1ac951ae..e1bc6b7b 100644 --- a/examples/modular_subcommands.py +++ b/examples/modular_subcommands.py @@ -95,10 +95,10 @@ class ExampleApp(cmd2.Cmd): @with_argparser(cut_parser) def do_cut(self, ns: argparse.Namespace): - func = getattr(ns, 'handler', None) - if func is not None: + handler = ns.get_handler() + if handler is not None: # Call whatever subcommand function was selected - func(ns) + handler(ns) else: # No subcommand was provided, so call help self.poutput('This command does nothing without sub-parsers registered') |