MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / register_precmd_hook

Method register_precmd_hook

cmd2/cmd2.py:5882–5885  ·  view source on GitHub ↗

Register a hook to be called before the command function.

(self, func: Callable[[plugin.PrecommandData], plugin.PrecommandData])

Source from the content-addressed store, hash-verified

5880 raise TypeError(f"{func.__name__} has incompatible return type {ret_ann}, expected {data_type}")
5881
5882 def register_precmd_hook(self, func: Callable[[plugin.PrecommandData], plugin.PrecommandData]) -> None:
5883 """Register a hook to be called before the command function."""
5884 self._validate_prepostcmd_hook(func, plugin.PrecommandData)
5885 self._precmd_hooks.append(func)
5886
5887 def register_postcmd_hook(self, func: Callable[[plugin.PostcommandData], plugin.PostcommandData]) -> None:
5888 """Register a hook to be called after the command function."""

Calls 2

appendMethod · 0.80