summaryrefslogtreecommitdiff
path: root/lib/command_match.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-10-06 00:03:39 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-10-06 00:03:39 +0000
commit03ca8d3dffb45aa1f20bc06802ca227a6b4e36cf (patch)
treeef7159c5dd01737fc6e71541dd60d8b4152fd9f0 /lib/command_match.c
parentb4f56274fa6aa7240e06a67da0e85bfd0e4b2052 (diff)
lib: Check match level when calculating completions
Adds a missing check that resulted in partial token matches being accepted as exact matches when calculating input completions. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command_match.c')
-rw-r--r--lib/command_match.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/command_match.c b/lib/command_match.c
index 36efa3e76d..ac6a6c813a 100644
--- a/lib/command_match.c
+++ b/lib/command_match.c
@@ -328,6 +328,7 @@ command_complete (struct graph *graph,
for (ALL_LIST_ELEMENTS_RO (current,node,gn))
{
struct cmd_token *token = gn->data;
+ enum match_type minmatch = min_match_level (token->type);
#ifdef TRACE_MATCHER
fprintf (stdout, "\"%s\" matches \"%s\" (%d) ? ", input_token, token->text, token->type);
#endif
@@ -347,6 +348,8 @@ command_complete (struct graph *graph,
listnode_add (next, gn);
break;
}
+ if (minmatch > partly_match)
+ break;
case exact_match:
#ifdef TRACE_MATCHER
fprintf (stdout, "exact_match\n");