Skip to content

Commit

Permalink
lib: Check match level when calculating completions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
qlyoung committed Oct 6, 2016
1 parent b4f5627 commit 03ca8d3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/command_match.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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");
Expand Down

0 comments on commit 03ca8d3

Please sign in to comment.