diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-11-10 23:17:07 +0000 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2016-11-10 23:17:07 +0000 |
| commit | ce882f81683f6b3547d4bad17aeee8ce7b5bdda1 (patch) | |
| tree | 409d95cec6499982694a35be6c7acb82c7194b24 /lib/command.c | |
| parent | 4c4ff4c13693ff2beb18931577423edcdc4a0403 (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.c')
| -rw-r--r-- | lib/command.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/command.c b/lib/command.c index 8eee923144..c0b9ee4e10 100644 --- a/lib/command.c +++ b/lib/command.c @@ -235,7 +235,7 @@ install_node (struct cmd_node *node, node->cmdgraph = graph_new (); node->cmd_vector = vector_init (VECTOR_MIN_SIZE); // add start node - struct cmd_token *token = new_cmd_token (START_TKN, NULL, NULL); + struct cmd_token *token = new_cmd_token (START_TKN, CMD_ATTR_NORMAL, NULL, NULL); graph_new_node (node->cmdgraph, token, (void (*)(void *)) &del_cmd_token); node->cmd_hash = hash_create (cmd_hash_key, cmd_hash_cmp); } @@ -2383,10 +2383,11 @@ cmd_init (int terminal) } struct cmd_token * -new_cmd_token (enum cmd_token_type type, char *text, char *desc) +new_cmd_token (enum cmd_token_type type, u_char attr, char *text, char *desc) { struct cmd_token *token = XMALLOC (MTYPE_CMD_TOKENS, sizeof (struct cmd_token)); token->type = type; + token->attr = attr; token->text = text; token->desc = desc; token->arg = NULL; @@ -2412,7 +2413,7 @@ del_cmd_token (struct cmd_token *token) struct cmd_token * copy_cmd_token (struct cmd_token *token) { - struct cmd_token *copy = new_cmd_token (token->type, NULL, NULL); + struct cmd_token *copy = new_cmd_token (token->type, token->attr, NULL, NULL); copy->max = token->max; copy->min = token->min; copy->text = token->text ? XSTRDUP (MTYPE_CMD_TOKENS, token->text) : NULL; |
