diff options
author | Eric Lin <anselor@gmail.com> | 2020-08-04 11:56:57 -0400 |
---|---|---|
committer | anselor <anselor@gmail.com> | 2020-08-04 13:38:08 -0400 |
commit | 4c0bdad9acd578536436246023ae884755089040 (patch) | |
tree | cd5e9a4f296982ff870f12023e38a6edd6954d51 /docs/features | |
parent | 2d24953c71f8e850b5925c3923cbb596de4b0813 (diff) | |
download | cmd2-git-4c0bdad9acd578536436246023ae884755089040.tar.gz |
Minor formatting fixes. Injecting a function into namespace objects before passing to command handlers to access sub-command handlers
Diffstat (limited to 'docs/features')
-rw-r--r-- | docs/features/modular_commands.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/features/modular_commands.rst b/docs/features/modular_commands.rst index 4c7286b7..9823d3ac 100644 --- a/docs/features/modular_commands.rst +++ b/docs/features/modular_commands.rst @@ -314,10 +314,10 @@ command and each CommandSet @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') |