2021-05-13 00:50:02

by Stotland, Inga

[permalink] [raw]
Subject: [PATCH BlueZ] shared/shell: Print help info for individual commands

For menus with long list of entries, it is useful to be able invoke
help message for an individual entry to look up command description and
synopsis.
Can be invoked by entering "<command> help" or "<command> --help".
---
src/shared/shell.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/src/shared/shell.c b/src/shared/shell.c
index c0de1640d..07eaa1702 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
@@ -352,6 +352,16 @@ static int cmd_exec(const struct bt_shell_menu_entry *entry,
int flags = WRDE_NOCMD;
bool optargs = false;

+ if (argc == 2 && (!memcmp(argv[1], "help", 4) ||
+ !memcmp(argv[1], "--help", 6))) {
+ printf("%s\n", entry->desc);
+ printf(COLOR_HIGHLIGHT "Usage:" COLOR_OFF "\n");
+ printf("\t %s %-*s\n", entry->cmd,
+ (int)(CMD_LENGTH - strlen(entry->cmd)),
+ !entry->arg ? "" : entry->arg);
+ return 0;
+ }
+
if (!entry->arg || entry->arg[0] == '\0') {
if (argc > 1) {
print_text(COLOR_HIGHLIGHT, "Too many arguments");
--
2.26.3


2021-05-13 01:45:54

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ] shared/shell: Print help info for individual commands

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=481581

---Test result---

Test Summary:
CheckPatch PASS 0.53 seconds
GitLint PASS 0.14 seconds
Prep - Setup ELL PASS 40.14 seconds
Build - Prep PASS 0.10 seconds
Build - Configure PASS 7.03 seconds
Build - Make PASS 167.38 seconds
Make Check PASS 8.21 seconds
Make Distcheck PASS 190.10 seconds
Build w/ext ELL - Configure PASS 6.57 seconds
Build w/ext ELL - Make PASS 148.17 seconds

Details
##############################
Test: CheckPatch - PASS
Desc: Run checkpatch.pl script with rule in .checkpatch.conf

##############################
Test: GitLint - PASS
Desc: Run gitlint with rule in .gitlint

##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration



---
Regards,
Linux Bluetooth

2021-05-14 00:45:29

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: Re: [BlueZ] shared/shell: Print help info for individual commands

Hi Inga,

On Wed, May 12, 2021 at 6:45 PM <[email protected]> wrote:
>
> This is automated email and please do not reply to this email!
>
> Dear submitter,
>
> Thank you for submitting the patches to the linux bluetooth mailing list.
> This is a CI test results with your patch series:
> PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=481581
>
> ---Test result---
>
> Test Summary:
> CheckPatch PASS 0.53 seconds
> GitLint PASS 0.14 seconds
> Prep - Setup ELL PASS 40.14 seconds
> Build - Prep PASS 0.10 seconds
> Build - Configure PASS 7.03 seconds
> Build - Make PASS 167.38 seconds
> Make Check PASS 8.21 seconds
> Make Distcheck PASS 190.10 seconds
> Build w/ext ELL - Configure PASS 6.57 seconds
> Build w/ext ELL - Make PASS 148.17 seconds
>
> Details
> ##############################
> Test: CheckPatch - PASS
> Desc: Run checkpatch.pl script with rule in .checkpatch.conf
>
> ##############################
> Test: GitLint - PASS
> Desc: Run gitlint with rule in .gitlint
>
> ##############################
> Test: Prep - Setup ELL - PASS
> Desc: Clone, build, and install ELL
>
> ##############################
> Test: Build - Prep - PASS
> Desc: Prepare environment for build
>
> ##############################
> Test: Build - Configure - PASS
> Desc: Configure the BlueZ source tree
>
> ##############################
> Test: Build - Make - PASS
> Desc: Build the BlueZ source tree
>
> ##############################
> Test: Make Check - PASS
> Desc: Run 'make check'
>
> ##############################
> Test: Make Distcheck - PASS
> Desc: Run distcheck to check the distribution
>
> ##############################
> Test: Build w/ext ELL - Configure - PASS
> Desc: Configure BlueZ source with '--enable-external-ell' configuration
>
> ##############################
> Test: Build w/ext ELL - Make - PASS
> Desc: Build BlueZ source with '--enable-external-ell' configuration
>
>
>
> ---
> Regards,
> Linux Bluetooth

Applied, thanks.

--
Luiz Augusto von Dentz