summaryrefslogtreecommitdiff
path: root/lib/command.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2017-01-19 17:07:39 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2017-01-19 17:15:45 +0000
commit5320569435c057a4e209700bdad71256432536fc (patch)
tree85e1f63a586345c048f71646fdb83bcce28558a9 /lib/command.c
parent45680e7568eb69d5f991b5c0c174e479878727ee (diff)
lib: guard strict cli completions
Completions are checked for token and docstring equality before deduplicating. Put an ifdef guard around checking docstrings because many of them are inconsistent and may confuse users in a release build. It is a good idea to enable VTYSH_DEBUG when adding new CLI in the future to help check docstrings. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command.c')
-rw-r--r--lib/command.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/command.c b/lib/command.c
index 6294e994e7..b5dae5f28e 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -541,8 +541,12 @@ completions_to_vec (struct list *completions)
for (i = 0; i < vector_active (comps) && !exists; i++)
{
struct cmd_token *curr = vector_slot (comps, i);
+#ifdef VTYSH_DEBUG
exists = !strcmp (curr->text, token->text) &&
!strcmp (curr->desc, token->desc);
+#else
+ exists = !strcmp (curr->text, token->text);
+#endif /* VTYSH_DEBUG */
}
if (!exists)