summaryrefslogtreecommitdiff
path: root/doc/developer/cli.rst
diff options
context:
space:
mode:
Diffstat (limited to 'doc/developer/cli.rst')
-rw-r--r--doc/developer/cli.rst34
1 files changed, 18 insertions, 16 deletions
diff --git a/doc/developer/cli.rst b/doc/developer/cli.rst
index 61b9cf6acb..59073b39ab 100644
--- a/doc/developer/cli.rst
+++ b/doc/developer/cli.rst
@@ -639,13 +639,14 @@ in order into ``*argv[]``. Before this happens the ``->arg`` field is set to
point at the snippet of user input that matched it.
For most nontrivial commands the handler function will need to determine which
-of the possible matching inputs was entered. Previously this was done by looking
-at the first few characters of input. This is now considered an anti-pattern and
-should be avoided. Instead, the ``->type`` or ``->text`` fields for this logic.
-The ``->type`` field can be used when the possible inputs differ in type. When
-the possible types are the same, use the ``->text`` field. This field has the
-full text of the corresponding token in the definition string and using it makes
-for much more readable code. An example is helpful.
+of the possible matching inputs was entered. Previously this was done by
+looking at the first few characters of input. This is now considered an
+anti-pattern and should be avoided. Instead, use the ``->type`` or ``->text``
+fields for this logic. The ``->type`` field can be used when the possible
+inputs differ in type. When the possible types are the same, use the ``->text``
+field. This field has the full text of the corresponding token in the
+definition string and using it makes for much more readable code. An example is
+helpful.
Command definition:
@@ -654,9 +655,10 @@ Command definition:
command <(1-10)|foo|BAR>
In this example, the user may enter any one of:
-- an integer between 1 and 10
-- "foo"
-- anything at all
+
+* an integer between 1 and 10
+* "foo"
+* anything at all
If the user enters "command f", then:
@@ -793,12 +795,12 @@ Adding a CLI Node
To add a new CLI node, you should:
-- define a new numerical node constant
-- define a node structure in the relevant daemon
-- call ``install_node()`` in the relevant daemon
-- define and install the new node in vtysh
-- define corresponding node entry commands in daemon and vtysh
-- add a new entry to the ``ctx_keywords`` dictionary in ``tools/frr-reload.py``
+#. define a new numerical node constant
+#. define a node structure in the relevant daemon
+#. call ``install_node()`` in the relevant daemon
+#. define and install the new node in vtysh
+#. define corresponding node entry commands in daemon and vtysh
+#. add a new entry to the ``ctx_keywords`` dictionary in ``tools/frr-reload.py``
Defining the numerical node constant
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^