summaryrefslogtreecommitdiff
path: root/docs/features/plugins.rst
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2020-02-20 22:38:23 -0700
committerkotfu <kotfu@kotfu.net>2020-02-20 22:38:23 -0700
commitc91fd00368aa6d699ce3f3019562664f340543d1 (patch)
treeeba2b5d5af5d5c91c43657ab5c53b3ae8a201f1d /docs/features/plugins.rst
parent36465ad953ac550626d219bb08c7ef214eaaede0 (diff)
downloadcmd2-git-c91fd00368aa6d699ce3f3019562664f340543d1.tar.gz
plugin and hook documentation updates
- add api documentation for plugin data classes - update hook and plugin documentation to link to now documented api classes
Diffstat (limited to 'docs/features/plugins.rst')
-rw-r--r--docs/features/plugins.rst18
1 files changed, 11 insertions, 7 deletions
diff --git a/docs/features/plugins.rst b/docs/features/plugins.rst
index 00c0a9f0..d6e3eb9c 100644
--- a/docs/features/plugins.rst
+++ b/docs/features/plugins.rst
@@ -55,6 +55,7 @@ This is required for two reasons:
If you mixin the plugin after ``cmd2.Cmd``, the python method resolution
order will call ``cmd2.Cmd`` methods before it calls those in your plugin.
+
Add commands
~~~~~~~~~~~~
@@ -70,6 +71,7 @@ You have all the same capabilities within the plugin that you do inside a
``cmd2.Cmd`` app, including argument parsing via decorators and custom help
methods.
+
Add (or hide) settings
~~~~~~~~~~~~~~~~~~~~~~
@@ -87,12 +89,14 @@ example::
You can also hide settings from the user by removing them from
``self.settables``.
+
Decorators
~~~~~~~~~~
Your plugin can provide a decorator which users of your plugin can use to
wrap functionality around their own commands.
+
Override methods
~~~~~~~~~~~~~~~~
@@ -104,13 +108,15 @@ will have the overridden method called.
Hooks are a much better approach.
+
Hooks
~~~~~
-Plugins can register hooks, which are called by ``cmd2.Cmd`` during various
-points in the application and command processing lifecycle. Plugins should
-not override any of the deprecated hook methods, instead they should register
-their hooks as described in the :ref:`features/hooks:Hooks` section.
+Plugins can register hook methods, which are called by :class:`~cmd2.Cmd`
+during various points in the application and command processing lifecycle.
+Plugins should not override any of the deprecated hook methods, instead they
+should register their hooks as described in the :ref:`features/hooks:Hooks`
+section.
You should name your hooks so that they begin with the name of your plugin.
Hook methods get mixed into the ``cmd2`` application and this naming
@@ -152,6 +158,4 @@ available.
Examples
--------
-.. _cmd2_plugin_template: https://github.com/python-cmd2/cmd2-plugin-template
-
-See cmd2_plugin_template_ for more info.
+See `<https://github.com/python-cmd2/cmd2-plugin-template>`_ for more info.