[PATCH v2 4/4] shared/shell: Print usage when no argument generator is set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

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..bd5cf18fc 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);
+			break;
+		}
 
 		rl_completion_display_matches_hook = entry->disp;
 		matches = rl_completion_matches(text, entry->gen);
-- 
2.13.6

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux