@@ -239,7 +239,7 @@ Here's how to define and register a postcommand hook::
239
239
self.register_postcmd_hook(self.myhookmethod)
240
240
241
241
def myhookmethod(self, data: cmd2.plugin.PostcommandData) -> cmd2.plugin.PostcommandData:
242
- return stop
242
+ return data
243
243
244
244
Your hook will be passed a ``PostcommandData `` object, which has a ``statement ``
245
245
attribute that describes the command which was executed. If your postcommand
@@ -254,10 +254,11 @@ After all registered postcommand hooks have been called,
254
254
``self.postcmd(statement) `` will be called to retain full backward compatibility
255
255
with ``cmd.Cmd ``.
256
256
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.
261
262
262
263
Any postcommand hook can change the value of the ``stop `` parameter before
263
264
returning it, and the modified value will be passed to the next postcommand
0 commit comments