From 481776becf0050a9a6de0f0da1f75ec5df62ca66 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 20 Jul 2022 11:52:17 -0400 Subject: [PATCH] doc/mgr: use subsections for two approaches to exposing commands This makes the content for each approach clearer and prepares for a future sub-section. Signed-off-by: John Mulligan --- doc/mgr/modules.rst | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/doc/mgr/modules.rst b/doc/mgr/modules.rst index 9fb3b87ae3f..8fea5624141 100644 --- a/doc/mgr/modules.rst +++ b/doc/mgr/modules.rst @@ -108,9 +108,13 @@ following commands:: Exposing commands ----------------- -There are two approaches for exposing a command. The first one is to -use the ``@CLICommand`` decorator to decorate the method which handles -the command. like this +There are two approaches for exposing a command. The first method involves using +the ``@CLICommand`` decorator to decorate the methods needed to handle a command. +The second method uses a ``COMMANDS`` attribute defined for the module class. + + +The CLICommand approach +~~~~~~~~~~~~~~~~~~~~~~~ .. code:: python @@ -164,7 +168,11 @@ In addition to ``@CLICommand``, you could also use ``@CLIReadCommand`` or ``@CLIWriteCommand`` if your command only requires read permissions or write permissions respectively. -The second one is to set the ``COMMANDS`` class attribute of your module to + +The COMMANDS Approach +~~~~~~~~~~~~~~~~~~~~~ + +This method uses the ``COMMANDS`` class attribute of your module to define a list of dicts like this:: COMMANDS = [