shell: fix execute command when help not active
When help functionality is not compiled and command is called with -h or --help option shell will now either pass this option as an argument or it will print a message that command does not have a handler. Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This commit is contained in:
parent
f7f4fe33a1
commit
956b00388f
1 changed files with 4 additions and 3 deletions
|
@ -527,7 +527,7 @@ static int exec_cmd(const struct shell *shell, size_t argc, char **argv,
|
|||
int ret_val = 0;
|
||||
|
||||
if (shell->ctx->active_cmd.handler == NULL) {
|
||||
if (help_entry.help) {
|
||||
if ((help_entry.help) && IS_ENABLED(CONFIG_SHELL_HELP)) {
|
||||
if (help_entry.help != shell->ctx->active_cmd.help) {
|
||||
shell->ctx->active_cmd = help_entry;
|
||||
}
|
||||
|
@ -636,8 +636,9 @@ static int execute(const struct shell *shell)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[cmd_lvl], "-h") ||
|
||||
!strcmp(argv[cmd_lvl], "--help")) {
|
||||
if (IS_ENABLED(CONFIG_SHELL_HELP) &&
|
||||
(!strcmp(argv[cmd_lvl], "-h") ||
|
||||
!strcmp(argv[cmd_lvl], "--help"))) {
|
||||
/* Command called with help option so it makes no sense
|
||||
* to search deeper commands.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue