summaryrefslogtreecommitdiff
path: root/zephyr/shim/src
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2021-08-13 15:45:33 -0600
committerCommit Bot <commit-bot@chromium.org>2021-08-18 23:45:57 +0000
commit1c616f739262f1271617ff0979b8e7606d45a441 (patch)
treea8a81c658abcd1d9d01600b1063d1f03c02bcec2 /zephyr/shim/src
parentf78eee4550dc747b558c1dfc333ba9b629216f39 (diff)
downloadchrome-ec-1c616f739262f1271617ff0979b8e7606d45a441.tar.gz
zephyr: Disable console help strings
Add support for disabling the console command help strings. With CONFIG_SHELL_HELP=n, 2000 bytes saved on Volteer BUG=none BRANCH=none TEST=zmake testall TEST=Verify console on Volteer with and without CONFIG_SHELL_HELP enabled. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I2186828f28691182f673851ac27d207b4a4a6f44 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3093492 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'zephyr/shim/src')
-rw-r--r--zephyr/shim/src/console.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/zephyr/shim/src/console.c b/zephyr/shim/src/console.c
index 929f7a9d1c..23f169f70c 100644
--- a/zephyr/shim/src/console.c
+++ b/zephyr/shim/src/console.c
@@ -164,10 +164,16 @@ void uart_shell_start(void)
int zshim_run_ec_console_command(const struct zephyr_console_command *command,
size_t argc, char **argv)
{
+ /*
+ * The Zephyr shell only displays the help string and not
+ * the argument descriptor when passing "-h" or "--help". Mimic the
+ * cros-ec behavior by displaying both the user types "<command> help",
+ */
+#ifdef CONFIG_SHELL_HELP
for (int i = 1; i < argc; i++) {
if (!command->help && !command->argdesc)
break;
- if (!strcmp(argv[i], "-h")) {
+ if (!strcmp(argv[i], "help")) {
if (command->help)
printk("%s\n", command->help);
if (command->argdesc)
@@ -175,6 +181,7 @@ int zshim_run_ec_console_command(const struct zephyr_console_command *command,
return 0;
}
}
+#endif
return command->handler(argc, argv);
}