Skip to contentSkip to conversation

shared/shell: Add submenu description

PATCH Applied Luiz Augusto von Dentz 1 participant 4 messages Dec 12, 2017 – Dec 13, 2017 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH v2 1/3 shared/shell: Add submenu description

From: Luiz Augusto von Dentz <[email protected]>

This adds a field for submenu description.

---
 src/shared/shell.c | 3 ++-
 src/shared/shell.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
src/shared/shell.c +2 -1
index 3aa49597c..b4fdf7043 100644
@@ -208,7 +208,8 @@ static void shell_print_menu(void)
 						submenu = submenu->next) {
 			struct bt_shell_menu *menu = submenu->data;
 
-			print_submenu(menu->name, "Submenu");
+			print_submenu(menu->name, menu->desc ? menu->desc :
+								"Submenu");
 		}
 	}
 
src/shared/shell.h +1 -0
index 5f86ed61e..8b8b1f634 100644
@@ -52,6 +52,7 @@ struct bt_shell_menu_entry {
 
 struct bt_shell_menu {
 	const char *name;
+	const char *desc;
 	const struct bt_shell_menu_entry entries[];
 };
 
Signature · 1 line
2.13.6
author maintainer
#1 lore raw

PATCH v2 2/3 client: Add description for submenus

From: Luiz Augusto von Dentz <[email protected]>

This adds proper descriptions for each submenu.

---
 client/main.c | 3 +++
 1 file changed, 3 insertions(+)
client/main.c +3 -0
index f3369e89a..5af4c97d8 100644
@@ -2202,6 +2202,7 @@ static void cmd_set_advertise_timeout(int argc, char *argv[])
 
 static const struct bt_shell_menu advertise_menu = {
 	.name = "advertise",
+	.desc = "Advertising Management Submenu",
 	.entries = {
 	{ "set-uuids", "[uuid1 uuid2 ...]",
 			cmd_set_advertise_uuids, "Set advertise uuids" },
@@ -2226,6 +2227,7 @@ static const struct bt_shell_menu advertise_menu = {
 
 static const struct bt_shell_menu scan_menu = {
 	.name = "scan",
+	.desc = "Scan Filters Submenu",
 	.entries = {
 	{ "set-filter-uuids", "[uuid1 uuid2 ...]", cmd_set_scan_filter_uuids,
 				"Set scan filter uuids" },
@@ -2246,6 +2248,7 @@ static const struct bt_shell_menu scan_menu = {
 
 static const struct bt_shell_menu gatt_menu = {
 	.name = "gatt",
+	.desc = "Generic Attribute Submenu",
 	.entries = {
 	{ "list-attributes", "[dev]", cmd_list_attributes, "List attributes",
 							dev_generator },
Signature · 1 line
2.13.6
author maintainer
#2 lore raw

PATCH v2 3/3 mesh: Add description for submenus

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This adds proper descriptions for each submenu.

---
 mesh/config-client.c | 1 +
 mesh/onoff-model.c   | 1 +
 2 files changed, 2 insertions(+)
mesh/config-client.c +1 -0
index 3d618b6a6..aad6525c2 100644
@@ -613,6 +613,7 @@ static void cmd_get_ttl(int argc, char *argv[])
 
 static const struct bt_shell_menu cfg_menu = {
 	.name = "config",
+	.desc = "Configuration Model Submenu",
 	.entries = {
 	{"target",		"<unicast>",			cmd_set_node,
 						"Set target node to configure"},
mesh/onoff-model.c +1 -0
index fc0d64617..dbbe69706 100644
@@ -259,6 +259,7 @@ static void cmd_set(int argc, char *argv[])
 
 static const struct bt_shell_menu onoff_menu = {
 	.name = "onoff",
+	.desc = "On/Off Model Submenu",
 	.entries = {
 	{"target",		"<unicast>",			cmd_set_node,
 						"Set node to configure"},
Signature · 1 line
2.13.6
author maintainer Applied
#3 lore raw
In reply to Luiz Augusto von Dentz

Hi,

Quoted 35 lines · Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This adds a field for submenu description.

---
 src/shared/shell.c | 3 ++-
 src/shared/shell.h | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
src/shared/shell.c +2 -1
index 3aa49597c..b4fdf7043 100644
@@ -208,7 +208,8 @@ static void shell_print_menu(void)
                                                submenu = submenu->next) {
                        struct bt_shell_menu *menu = submenu->data;
 
-                       print_submenu(menu->name, "Submenu");
+                       print_submenu(menu->name, menu->desc ? menu->desc :
+                                                               "Submenu");
                }
        }
 
src/shared/shell.h +1 -1
index 5f86ed61e..8b8b1f634 100644
@@ -52,6 +52,7 @@ struct bt_shell_menu_entry {
 
 struct bt_shell_menu {
        const char *name;
+       const char *desc;
        const struct bt_shell_menu_entry entries[];
 };
 
--
Quoted 1 line

2.13.6

Applied.

Signature · 1 line
Luiz Augusto von Dentz