Skip to content

Commit

Permalink
Merge pull request #624 from python-cmd2/doc_updates
Browse files Browse the repository at this point in the history
Minor doc updates that fix a few typos and inaccuracies
  • Loading branch information
tleonhardt committed Feb 7, 2019
2 parents 911d965 + ec404a6 commit bc9fd93
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions docs/argument_processing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -108,7 +109,7 @@ With this code::
self.stdout.write('<{0}>{1}</{0}>'.format(args.tag, ' '.join(args.content)))
self.stdout.write('\n')

The ``help tag`` command displays:
the ``help tag`` command displays:

.. code-block:: none
Expand Down
1 change: 0 additions & 1 deletion docs/freefeatures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions docs/hooks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit bc9fd93

Please sign in to comment.