From 012f7ae4e9b5b9af9b2796867d49aceec7749d64 Mon Sep 17 00:00:00 2001 From: Sergei Rozhkov Date: Mon, 28 Nov 2022 16:14:25 +0500 Subject: [PATCH] vtysh: add motd command Add "show motd" commad. The vtysh user can call the "show motd" command to re-show the welcome message. This is necessary if the user saves frequently used commands in motd. Signed-off-by: Sergei Rozhkov --- doc/user/basic.rst | 4 ++++ vtysh/vtysh.c | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/doc/user/basic.rst b/doc/user/basic.rst index 7679a377eb..4a64d8f949 100644 --- a/doc/user/basic.rst +++ b/doc/user/basic.rst @@ -617,6 +617,10 @@ Terminal Mode Commands usage is printed sequentially. You can specify the daemon's name to print only its memory usage. +.. clicmd:: show motd + + Show current motd banner. + .. clicmd:: show history Dump the vtysh cli history. diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 30f117505a..dea09fa151 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -3939,6 +3939,12 @@ DEFUN (vtysh_ping, return CMD_SUCCESS; } +DEFUN(vtysh_motd, vtysh_motd_cmd, "show motd", SHOW_STR "Show motd\n") +{ + vty_hello(vty); + return CMD_SUCCESS; +} + ALIAS(vtysh_ping, vtysh_ping_ip_cmd, "ping ip WORD", "Send echo messages\n" "IP echo\n" @@ -4907,6 +4913,7 @@ void vtysh_init_vty(void) install_element(VIEW_NODE, &no_vtysh_terminal_monitor_cmd); install_element(VIEW_NODE, &vtysh_ping_cmd); + install_element(VIEW_NODE, &vtysh_motd_cmd); install_element(VIEW_NODE, &vtysh_ping_ip_cmd); install_element(VIEW_NODE, &vtysh_traceroute_cmd); install_element(VIEW_NODE, &vtysh_traceroute_ip_cmd); -- 2.39.5