From: John Mulligan Date: Wed, 20 Jul 2022 15:52:17 +0000 (-0400) Subject: doc/mgr: use subsections for two approaches to exposing commands X-Git-Tag: v18.0.0~130^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=481776becf0050a9a6de0f0da1f75ec5df62ca66;p=ceph.git 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 --- diff --git a/doc/mgr/modules.rst b/doc/mgr/modules.rst index 9fb3b87ae3f3..8fea56241416 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 = [