Skip to content

Commit 422657b

Browse files
ycsinnashif
authored andcommitted
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 <[email protected]> Signed-off-by: Yong Cong Sin <[email protected]> (cherry picked from commit fd1be98)
1 parent 480fa71 commit 422657b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

subsys/shell/shell_help.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ static void help_item_print(const struct shell *sh, const char *item_name,
110110
uint16_t item_name_width, const char *item_help)
111111
{
112112
static const uint8_t tabulator[] = " ";
113-
const uint16_t offset = 2 * strlen(tabulator) + item_name_width + 1;
113+
static const char sub_cmd_sep[] = ": "; /* subcommands separator */
114+
const uint16_t offset = 2 * strlen(tabulator) + item_name_width + strlen(sub_cmd_sep);
114115

115116
if ((item_name == NULL) || (item_name[0] == '\0')) {
116117
return;

0 commit comments

Comments
 (0)