Commit 78e9e68d authored by Alessandro Rubini's avatar Alessandro Rubini

shell: add help command

The help command currently only lists available commands. It was asked
by some developers some time ago, and this implementation only costs
150 bytes in the final exectuable.  I don't think it's worth a Kconfig
option.

This is it in action with my configuration:

   wrc# help
   Available commands:
     ver
     pll
     sfp
     stat
     ptp
     mode
     calibration
     time
     gui
     sdb
     mac
     init
     ptrack
     ip
     verbose
     help
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent bebe796c
/*
* This work is part of the White Rabbit project
*
* Copyright (C) 2012 CERN (www.cern.ch)
* Author: Alessandro Rubini <rubini@gnudd.com>
*
* Released according to the GNU GPL, version 2 or any later version.
*/
#include <stdlib.h>
#include <string.h>
#include <wrc.h>
#include <shell.h>
static int cmd_help(const char *args[])
{
struct wrc_shell_cmd *p;
pp_printf("Available commands:\n");
for (p = __cmd_begin; p < __cmd_end; p++)
pp_printf(" %s\n", p->name);
return 0;
}
DEFINE_WRC_COMMAND(help) = {
.name = "help",
.exec = cmd_help,
};
......@@ -12,7 +12,8 @@ obj-y += \
shell/cmd_sdb.o \
shell/cmd_mac.o \
shell/cmd_init.o \
shell/cmd_ptrack.o
shell/cmd_ptrack.o \
shell/cmd_help.o
obj-$(CONFIG_ETHERBONE) += shell/cmd_ip.o
obj-$(CONFIG_PPSI_RUNTIME_VERBOSITY) += shell/cmd_verbose.o
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment