shell: unify commands execution

This change removes special handling for shell root commands.
Currently there is one loop in execute function that is used
to search commands on each level.

Fixed a bug where command buffer has been processed twice
when it was not needed (wildcards not found).

This change will allow to simplify "select" command
introduction.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This commit is contained in:
Jakub Rzeszutko 2019-02-08 14:51:21 +01:00 committed by Anas Nashif
commit 2f040d8188
3 changed files with 26 additions and 41 deletions

View file

@ -64,7 +64,7 @@ void shell_cmd_get(const struct shell_cmd_entry *command, size_t lvl,
int shell_command_add(char *buff, u16_t *buff_len,
const char *new_cmd, const char *pattern);
const struct shell_cmd_entry *shell_root_cmd_find(const char *syntax);
const struct shell_static_entry *shell_root_cmd_find(const char *syntax);
void shell_spaces_trim(char *str);