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

Method register_preloop_hook

cmd2/cmd2.py:5831–5834  ·  view source on GitHub ↗

Register a function to be called at the beginning of the command loop.

(self, func: Callable[[], None])

Source from the content-addressed store, hash-verified

5829 raise TypeError(f"{func.__name__} must have a return type of 'None', got: {ret_ann}")
5830
5831 def register_preloop_hook(self, func: Callable[[], None]) -> None:
5832 """Register a function to be called at the beginning of the command loop."""
5833 self._validate_prepostloop_callable(func)
5834 self._preloop_hooks.append(func)
5835
5836 def register_postloop_hook(self, func: Callable[[], None]) -> None:
5837 """Register a function to be called at the end of the command loop."""

Callers 6

test_preloop_hookFunction · 0.80
test_preloop_hooksFunction · 0.80
__init__Method · 0.80
__init__Method · 0.80

Calls 2

appendMethod · 0.80