A wrapper around CommandHandlerRegistry.register_command_handler(). In addition to calling the wrapped register_command_handler() method, this method also registers the top-level tab-completion context based on the command prefixes and their aliases. See the doc string of the wrapp
(self,
prefix,
handler,
help_info,
prefix_aliases=None)
| 80 | self._command_handler_registry.set_help_intro(help_intro=help_intro) |
| 81 | |
| 82 | def register_command_handler(self, |
| 83 | prefix, |
| 84 | handler, |
| 85 | help_info, |
| 86 | prefix_aliases=None): |
| 87 | """A wrapper around CommandHandlerRegistry.register_command_handler(). |
| 88 | |
| 89 | In addition to calling the wrapped register_command_handler() method, this |
| 90 | method also registers the top-level tab-completion context based on the |
| 91 | command prefixes and their aliases. |
| 92 | |
| 93 | See the doc string of the wrapped method for more details on the args. |
| 94 | |
| 95 | Args: |
| 96 | prefix: (str) command prefix. |
| 97 | handler: (callable) command handler. |
| 98 | help_info: (str) help information. |
| 99 | prefix_aliases: (list of str) aliases of the command prefix. |
| 100 | """ |
| 101 | |
| 102 | self._command_handler_registry.register_command_handler( |
| 103 | prefix, handler, help_info, prefix_aliases=prefix_aliases) |
| 104 | |
| 105 | self._tab_completion_registry.extend_comp_items("", [prefix]) |
| 106 | if prefix_aliases: |
| 107 | self._tab_completion_registry.extend_comp_items("", prefix_aliases) |
| 108 | |
| 109 | def register_tab_comp_context(self, *args, **kwargs): |
| 110 | """Wrapper around TabCompletionRegistry.register_tab_comp_context().""" |