shell: make detecting help option optional

Shell will not "steal" by default "-h" and "--help" each time
help functions are enabled.
This change is necessary to implement and use the getopt library.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This commit is contained in:
Jakub Rzeszutko 2021-01-14 12:31:07 +01:00 committed by Anas Nashif
commit b64fb7c92d
4 changed files with 28 additions and 3 deletions

View file

@ -662,8 +662,7 @@ static int execute(const struct shell *shell)
}
if (IS_ENABLED(CONFIG_SHELL_HELP) && (cmd_lvl > 0) &&
(!strcmp(argvp[0], "-h") ||
!strcmp(argvp[0], "--help"))) {
z_shell_help_request(argvp[0])) {
/* Command called with help option so it makes no sense
* to search deeper commands.
*/