@@ -239,7 +239,7 @@ Here's how to define and register a postcommand hook::
239239 self.register_postcmd_hook(self.myhookmethod)
240240
241241 def myhookmethod(self, data: cmd2.plugin.PostcommandData) -> cmd2.plugin.PostcommandData:
242- return stop
242+ return data
243243
244244Your hook will be passed a ``PostcommandData `` object, which has a ``statement ``
245245attribute that describes the command which was executed. If your postcommand
@@ -254,10 +254,11 @@ After all registered postcommand hooks have been called,
254254``self.postcmd(statement) `` will be called to retain full backward compatibility
255255with ``cmd.Cmd ``.
256256
257- If any postcommand hook (registered or ``self.postcmd() ``) returns ``True ``,
258- subsequent postcommand hooks will still be called, as will the command
259- finalization hooks, but once those hooks have all been called, the application
260- will terminate.
257+ If any postcommand hook (registered or ``self.postcmd() ``) returns a ``PostcommandData `` object
258+ with the stop attribute set to ``True ``, subsequent postcommand hooks will still be called, as
259+ will the command finalization hooks, but once those hooks have all been called, the application
260+ will terminate. Likewise, if ``self.postcmd() `` returns ``True ``, the command finalization hooks
261+ will be called before the application terminates.
261262
262263Any postcommand hook can change the value of the ``stop `` parameter before
263264returning it, and the modified value will be passed to the next postcommand
0 commit comments