summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2018-05-27 21:35:34 -0600
committerkotfu <kotfu@kotfu.net>2018-05-27 21:35:34 -0600
commitf616d78ba70b6f48a2c94a66d4657f4e214b3155 (patch)
treeb4bf9969a30c48122342d7c73a332f6c665f409e /docs
parent019f69c3159707e1fb077317a33ffe343426b36c (diff)
downloadcmd2-git-f616d78ba70b6f48a2c94a66d4657f4e214b3155.tar.gz
Differentiate between postparsing hooks and precommand hooks
Diffstat (limited to 'docs')
-rw-r--r--docs/hooks.rst4
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/hooks.rst b/docs/hooks.rst
index 7141c729..b07f1e94 100644
--- a/docs/hooks.rst
+++ b/docs/hooks.rst
@@ -163,6 +163,10 @@ If a postparsing hook returns ``True`` as the first value in the tuple:
Precommand Hooks
^^^^^^^^^^^^^^^^^
+A precommand hook is defined in ``cmd.Cmd``. It is not able to request that the
+app terminate, but it is passed the user input and allowed to make changes. If
+your hook needs to be able to exit the application, you should implement it as a postparsing hook.
+
Once output is redirected and the timer started, all the hooks registered with
``register_precmd_hook()`` are called. Here's how you do it::