diff options
author | kotfu <kotfu@kotfu.net> | 2018-07-12 19:27:57 -0600 |
---|---|---|
committer | kotfu <kotfu@kotfu.net> | 2018-07-12 19:27:57 -0600 |
commit | 10ee6ba4291695ade3a8fe4f5b78582c67dada8d (patch) | |
tree | 66ea97bad4e3f2bfcbf26cd401acc0635419f27e /docs/hooks.rst | |
parent | 670f0eb7707b8a7e1e7368346c927244ead46b8b (diff) | |
download | cmd2-git-10ee6ba4291695ade3a8fe4f5b78582c67dada8d.tar.gz |
preloop() and postloop() should not have been shown as deprecated
Diffstat (limited to 'docs/hooks.rst')
-rw-r--r-- | docs/hooks.rst | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/docs/hooks.rst b/docs/hooks.rst index caeef75b..3c91c6bf 100644 --- a/docs/hooks.rst +++ b/docs/hooks.rst @@ -30,7 +30,11 @@ You can register methods to be called at the beginning of the command loop:: def myhookmethod(self): self.poutput("before the loop begins") -And also after the command loop has finished:: +To retain backwards compatibility with `cmd.Cmd`, after all registered preloop +hooks have been called, the ``preloop()`` method is called. + +A similar approach allows you to register functions to be called after the +command loop has finished:: class App(cmd2.Cmd): def __init__(self, *args, *kwargs): @@ -40,6 +44,9 @@ And also after the command loop has finished:: def myhookmethod(self): self.poutput("before the loop begins") +To retain backwards compatibility with `cmd.Cmd`, after all registered postloop +hooks have been called, the ``postloop()`` method is called. + Preloop and postloop hook methods are not passed any parameters and any return value is ignored. @@ -298,15 +305,6 @@ finalization hooks will be called. If the last hook to return a value returned ``True``, then the exception will be rendered, and the application will terminate. -Deprecated Application Lifecycle Hook Methods ---------------------------------------------- - -The ``preloop`` and ``postloop`` methods run before and after the main loop, respectively. - -.. automethod:: cmd2.cmd2.Cmd.preloop - -.. automethod:: cmd2.cmd2.Cmd.postloop - Deprecated Command Processing Hooks ----------------------------------- |