diff options
author | Bill Richardson <wfrichar@chromium.org> | 2016-08-25 13:07:54 -0700 |
---|---|---|
committer | Bill Richardson <wfrichar@chromium.org> | 2016-08-31 16:02:36 +0000 |
commit | 6d805476ba032b33e440330469a873e6a444fddb (patch) | |
tree | 07a9524ffbba605a1615b74f7f2f681afd32f8e7 /common/console.c | |
parent | 12b958dd8ad1e8d75308f924a0794448439d9b31 (diff) | |
download | chrome-ec-6d805476ba032b33e440330469a873e6a444fddb.tar.gz |
Add configs to add flags to console commands
If we add a .flags field to the console commands data structure,
we can use it to distinguish some commands from others, for
example to mark some commands as safe and others as dangerous.
This just adds the undefined CONFIG_ options. They aren't used
anywhere, so there's no behavioral difference yet.
BUG=chrome-os-partner:55322
BRANCH=none
TEST=make buildall
Change-Id: I17fdf177dcb4324c77565bd95344da1405ea15ed
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/376185
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/console.c')
-rw-r--r-- | common/console.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/common/console.c b/common/console.c index e64d07f8d7..3b5524b996 100644 --- a/common/console.c +++ b/common/console.c @@ -676,7 +676,7 @@ void console_task(void) static int command_help(int argc, char **argv) { const int ncmds = __cmds_end - __cmds; - const int cols = 5; /* printing in five columns */ + const int cols = 5; /* printing in five columns */ const int rows = (ncmds + cols - 1) / cols; int i, j; @@ -685,12 +685,22 @@ static int command_help(int argc, char **argv) const struct console_command *cmd; if (!strcasecmp(argv[1], "list")) { +#ifdef CONFIG_CONSOLE_COMMAND_FLAGS + ccputs("Command Flags Description\n"); + for (i = 0; i < ncmds; i++) { + ccprintf(" %-14s %x %s\n", + __cmds[i].name, __cmds[i].flags, + __cmds[i].help); + cflush(); + } +#else ccputs("Known commands:\n"); for (i = 0; i < ncmds; i++) { ccprintf(" %-15s%s\n", - __cmds[i].name, __cmds[i].shorthelp); + __cmds[i].name, __cmds[i].help); cflush(); } +#endif ccputs("HELP CMD = help on CMD.\n"); return EC_SUCCESS; } @@ -702,8 +712,8 @@ static int command_help(int argc, char **argv) } ccprintf("Usage: %s %s\n", cmd->name, (cmd->argdesc ? cmd->argdesc : "")); - if (cmd->shorthelp) - ccprintf("%s\n", cmd->shorthelp); + if (cmd->help) + ccprintf("%s\n", cmd->help); return EC_SUCCESS; } #endif |