shell: shell_help: fix width for subcommands help text

The terminal offset for subcommands' help text isn't
computed correctly, fix it.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
This commit is contained in:
Yong Cong Sin 2024-08-23 16:55:28 +08:00 committed by Carles Cufí
parent 276ccd04e7
commit fd1be9849c
1 changed files with 2 additions and 1 deletions

View File

@ -110,7 +110,8 @@ static void help_item_print(const struct shell *sh, const char *item_name,
uint16_t item_name_width, const char *item_help)
{
static const uint8_t tabulator[] = " ";
const uint16_t offset = 2 * strlen(tabulator) + item_name_width + 1;
static const char sub_cmd_sep[] = ": "; /* subcommands separator */
const uint16_t offset = 2 * strlen(tabulator) + item_name_width + strlen(sub_cmd_sep);
if ((item_name == NULL) || (item_name[0] == '\0')) {
return;