summaryrefslogtreecommitdiff
path: root/lib/command_match.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-11-10 23:17:07 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-11-10 23:17:07 +0000
commitce882f81683f6b3547d4bad17aeee8ce7b5bdda1 (patch)
tree409d95cec6499982694a35be6c7acb82c7194b24 /lib/command_match.c
parent4c4ff4c13693ff2beb18931577423edcdc4a0403 (diff)
lib: Implement hidden and deprecated commands
Each token now knows whether it is part of a hidden or deprecated command. Command completion logic hides such tokens when generating completions. Command matching logic works as before and will still match on hidden and deprecated commands. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command_match.c')
-rw-r--r--lib/command_match.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/command_match.c b/lib/command_match.c
index 42788ecb01..8fa8da6b10 100644
--- a/lib/command_match.c
+++ b/lib/command_match.c
@@ -331,6 +331,10 @@ command_complete (struct graph *graph,
for (ALL_LIST_ELEMENTS_RO (current,node,gn))
{
struct cmd_token *token = gn->data;
+
+ if (token->attr == CMD_ATTR_HIDDEN || token->attr == CMD_ATTR_DEPRECATED)
+ continue;
+
enum match_type minmatch = min_match_level (token->type);
#ifdef TRACE_MATCHER
fprintf (stdout, "\"%s\" matches \"%s\" (%d) ? ", input_token, token->text, token->type);