diff options
| author | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-07-25 14:20:55 -0400 |
|---|---|---|
| committer | Quentin Young <qlyoung@cumulusnetworks.com> | 2017-07-26 22:58:52 -0400 |
| commit | cf6c83e712733f41a870a9c077803bc2e29ac69e (patch) | |
| tree | e41c52bdb12126d69c99c4f808b2b85b55406caf /lib/command.c | |
| parent | a83a533139f64434b68ebc3ae9a65a013b04cc34 (diff) | |
lib, vtysh: add `find COMMAND`
Substring search through all defined commands in all nodes.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/command.c')
| -rw-r--r-- | lib/command.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/command.c b/lib/command.c index 2899a7c2ba..4690a36be0 100644 --- a/lib/command.c +++ b/lib/command.c @@ -42,7 +42,6 @@ #include "command_graph.h" #include "qobj.h" #include "defaults.h" -#include "termtable.h" DEFINE_MTYPE(LIB, HOST, "Host config") DEFINE_MTYPE(LIB, STRVEC, "String vector") @@ -2431,16 +2430,19 @@ DEFUN(find, "Text to search for\n") { char *text = argv_concat(argv, argc, 1); + const struct cmd_node *node; + const struct cmd_element *cli; + vector clis; for (unsigned int i = 0; i < vector_active(cmdvec); i++) { - struct cmd_node *node = vector_slot(cmdvec, i); + node = vector_slot(cmdvec, i); if (!node) continue; - vector clis = node->cmd_vector; + clis = node->cmd_vector; for (unsigned int j = 0; j < vector_active(clis); j++) { - struct cmd_element *cli = vector_slot(clis, j); + cli = vector_slot(clis, j); if (strcasestr(cli->string, text)) - vty_out(vty, "(%s) %s", + vty_out(vty, " (%s) %s\n", node_names[node->node], cli->string); } } |
