From: Donald Sharp Date: Thu, 3 Dec 2020 17:36:29 +0000 (-0500) Subject: doc, vtysh: Add a `show history` command X-Git-Tag: base_7.6~161^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=a65f4b5dc0f039654508ea4ed2c865004498bd77;p=matthieu%2Ffrr.git doc, vtysh: Add a `show history` command Dump the cli history to the user in vtysh when a `show history` command is entered. Signed-off-by: Donald Sharp --- 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);