From 847337155ee7ff8564b9482a8ffa5025c5f361e9 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Sun, 26 Nov 2017 22:06:35 +0200 Subject: [PATCH] shared/shell: Print usage when no argument generator is set This prints the command and arguments if the command don't provide a generator so one don't have to always resort to help for checking it. --- src/shared/shell.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/shared/shell.c b/src/shared/shell.c index 73aedaf79..e22d664f7 100644 --- a/src/shared/shell.c +++ b/src/shared/shell.c @@ -527,8 +527,12 @@ static char **menu_completion(const struct bt_shell_menu_entry *entry, if (strcmp(entry->cmd, input_cmd)) continue; - if (!entry->gen) - continue; + if (!entry->gen) { + if (text[0] == '\0') + bt_shell_printf("Usage: %s %s\n", entry->cmd, + entry->arg ? entry->arg : ""); + break; + } rl_completion_display_matches_hook = entry->disp; matches = rl_completion_matches(text, entry->gen); -- 2.47.3