Skip to content
Permalink
Browse files

net: shell: Refactor help information for ping command

Do not always print general help for ping cmd. Only if user supplies
'-h' or '--help' command, print information about the parameters.
After this the generated HTML documentation looks better for the
ping command.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
  • Loading branch information...
jukkar committed May 21, 2019
1 parent d13039f commit ecac10cb4762144a4bc90055cddc011b6e0ed1ab
Showing with 10 additions and 2 deletions.
  1. +1 −1 doc/reference/networking/net_shell.rst
  2. +9 −1 subsys/net/ip/net_shell.c
@@ -31,7 +31,7 @@ The following net-shell commands are implemented:
print more information if :option:`CONFIG_NET_BUF_POOL_USAGE` is set."
"net nbr", "Print neighbor information. Only available if
:option:`CONFIG_NET_IPV6` is set."
"net ping [-c count] [-i interval ms]", "Ping a network host."
"net ping", "Ping a network host."
"net route", "Show IPv6 network routes. Only available if
:option:`CONFIG_NET_ROUTE` is set."
"net stats", "Show network statistics."
@@ -3911,6 +3911,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE(net_cmd_vlan,
SHELL_SUBCMD_SET_END
);

SHELL_STATIC_SUBCMD_SET_CREATE(net_cmd_ping,
SHELL_CMD(--help, NULL,
"'net ping [-c count] [-i interval ms] <host>' "
"Send ICMPv4 or ICMPv6 Echo-Request to a network host.",
cmd_net_ping),
SHELL_SUBCMD_SET_END
);

SHELL_STATIC_SUBCMD_SET_CREATE(net_commands,
SHELL_CMD(allocs, NULL, "Print network memory allocations.",
cmd_net_allocs),
@@ -3933,7 +3941,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(net_commands,
cmd_net_mem),
SHELL_CMD(nbr, &net_cmd_nbr, "Print neighbor information.",
cmd_net_nbr),
SHELL_CMD(ping, NULL, "'net ping [-c count] [-i interval ms] <host>' ping a network host.", cmd_net_ping),
SHELL_CMD(ping, &net_cmd_ping, "Ping a network host.", cmd_net_ping),
SHELL_CMD(route, NULL, "Show network route.", cmd_net_route),
SHELL_CMD(stacks, NULL, "Show network stacks information.",
cmd_net_stacks),

0 comments on commit ecac10c

Please sign in to comment.
You can’t perform that action at this time.