diff options
| author | Donatas Abraitis <donatas.abraitis@gmail.com> | 2020-12-04 10:25:18 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-04 10:25:18 +0200 |
| commit | 057edd2e84a6536615b4c80c67d83024ef8f3234 (patch) | |
| tree | bdd8e2a2e2e8be0194c168e141c32da39a549411 | |
| parent | d3e79428d7377ba4a5572f1bea6aba8ea26ba8d2 (diff) | |
| parent | a65f4b5dc0f039654508ea4ed2c865004498bd77 (diff) | |
Merge pull request #7663 from donaldsharp/vtysh_history_display
doc, vtysh: Add a `show history` command
| -rw-r--r-- | doc/user/basic.rst | 5 | ||||
| -rw-r--r-- | vtysh/vtysh.c | 17 |
2 files changed, 22 insertions, 0 deletions
diff --git a/doc/user/basic.rst b/doc/user/basic.rst index e941053f8c..1ca3ca3cf2 100644 --- a/doc/user/basic.rst +++ b/doc/user/basic.rst @@ -549,6 +549,11 @@ Terminal Mode Commands When executing this command from ``vtysh``, each of the daemons' memory usage is printed sequentially. +.. index:: show history +.. clicmd:: show history + + Dump the vtysh cli history. + .. index:: logmsg LEVEL MESSAGE .. clicmd:: logmsg LEVEL MESSAGE diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index ef0dfccba9..c78132508f 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -2676,6 +2676,22 @@ DEFUNSH(VTYSH_ALL, debug_nb, return CMD_SUCCESS; } +DEFUN (vtysh_show_history, + vtysh_show_history_cmd, + "show history", + SHOW_STR + "The list of commands stored in history\n") +{ + HIST_ENTRY **hlist = history_list(); + int i = 0; + + while (hlist[i]) { + vty_out(vty, "%s\n", hlist[i]->line); + i++; + } + return CMD_SUCCESS; +} + /* Memory */ DEFUN (vtysh_show_memory, vtysh_show_memory_cmd, @@ -4270,6 +4286,7 @@ void vtysh_init_vty(void) install_element(CONFIG_NODE, &debug_nb_cmd); /* misc lib show commands */ + install_element(VIEW_NODE, &vtysh_show_history_cmd); install_element(VIEW_NODE, &vtysh_show_memory_cmd); install_element(VIEW_NODE, &vtysh_show_modules_cmd); install_element(VIEW_NODE, &vtysh_show_work_queues_cmd); |
