diff --git a/docs/argument_processing.rst b/docs/argument_processing.rst index 12fd7a60e..4c77fa803 100644 --- a/docs/argument_processing.rst +++ b/docs/argument_processing.rst @@ -93,7 +93,8 @@ Help Messages By default, cmd2 uses the docstring of the command method when a user asks for help on the command. When you use the ``@with_argparser`` -decorator, the docstring for the ``do_*`` method is used to set the description for the ``argparse.ArgumentParser`` is +decorator, the docstring for the ``do_*`` method is used to set the description for the ``argparse.ArgumentParser``. + With this code:: import argparse @@ -108,7 +109,7 @@ With this code:: self.stdout.write('<{0}>{1}'.format(args.tag, ' '.join(args.content))) self.stdout.write('\n') -The ``help tag`` command displays: +the ``help tag`` command displays: .. code-block:: none diff --git a/docs/freefeatures.rst b/docs/freefeatures.rst index 7864f1466..c70a2d93b 100644 --- a/docs/freefeatures.rst +++ b/docs/freefeatures.rst @@ -135,7 +135,6 @@ You may optionally enable full access to to your application by setting session, which is a reference to your Cmd2 application. This can be useful for debugging your application. To prevent users from enabling this ability manually you'll need to remove ``locals_in_py`` from the ``settable`` dictionary. -That session can call The ``app`` object (or your custom name) provides access to application commands through either raw commands or through a python API wrapper. For example, any diff --git a/docs/hooks.rst b/docs/hooks.rst index 1696d365a..35753e593 100644 --- a/docs/hooks.rst +++ b/docs/hooks.rst @@ -239,7 +239,7 @@ Here's how to define and register a postcommand hook:: self.register_postcmd_hook(self.myhookmethod) def myhookmethod(self, data: cmd2.plugin.PostcommandData) -> cmd2.plugin.PostcommandData: - return stop + return data Your hook will be passed a ``PostcommandData`` object, which has a ``statement`` attribute that describes the command which was executed. If your postcommand @@ -254,10 +254,11 @@ After all registered postcommand hooks have been called, ``self.postcmd(statement)`` will be called to retain full backward compatibility with ``cmd.Cmd``. -If any postcommand hook (registered or ``self.postcmd()``) returns ``True``, -subsequent postcommand hooks will still be called, as will the command -finalization hooks, but once those hooks have all been called, the application -will terminate. +If any postcommand hook (registered or ``self.postcmd()``) returns a ``PostcommandData`` object +with the stop attribute set to ``True``, subsequent postcommand hooks will still be called, as +will the command finalization hooks, but once those hooks have all been called, the application +will terminate. Likewise, if ``self.postcmd()`` returns ``True``, the command finalization hooks +will be called before the application terminates. Any postcommand hook can change the value of the ``stop`` parameter before returning it, and the modified value will be passed to the next postcommand