summaryrefslogtreecommitdiff
path: root/lib/grammar_sandbox.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-08-01 20:30:14 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-08-01 20:30:14 +0000
commite1cbb2ff67441cac4a486efdb3b5584bd701cba0 (patch)
tree559caaa0cdddccb492e833baef0fde4a0ca0c96e /lib/grammar_sandbox.c
parente648e61a747c6c13ccea7d97066dfb07d4461d96 (diff)
lib: Add partial completion support
Completions now include nodes that the input partially matches as well as the children of nodes those that the input exactly matches. Also some minor cleanup and bugfixes. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/grammar_sandbox.c')
-rw-r--r--lib/grammar_sandbox.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c
index 90aadc6a9f..c53811e062 100644
--- a/lib/grammar_sandbox.c
+++ b/lib/grammar_sandbox.c
@@ -19,6 +19,7 @@ DEFUN (grammar_test,
cmd->string = command;
cmd->doc = NULL;
cmd->func = NULL;
+ cmd->tokens = vector_init(VECTOR_MIN_SIZE);
parse_command_format(nodegraph, cmd);
return CMD_SUCCESS;
}
@@ -45,7 +46,7 @@ DEFUN (grammar_test_complete,
"command to complete")
{
const char* command = argv_concat(argv, argc, 0);
- struct list *result = match_command_complete (nodegraph, command, FILTER_STRICT);
+ struct list *result = match_command_complete (nodegraph, command);
if (result->count == 0) // invalid command
fprintf(stderr, "%% Unknown command\n");
@@ -61,9 +62,6 @@ DEFUN (grammar_test_complete,
fprintf(stderr, "<cr> %p\n", cnode->element->func);
else
fprintf(stderr, "%s\n", describe_node(cnode, desc, 50));
-
- if (cnode->type == RANGE_GN)
- fprintf(stderr, "%lld - %lld\n", cnode->min, cnode->max);
}
free(desc);
}