diff options
author | Ronan Pigott <rpigott@berkeley.edu> | 2019-08-16 23:34:49 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2019-09-06 10:57:10 +0300 |
commit | d45b4ac3ecf3f2f7703384e00e4275fcca6cd793 (patch) | |
tree | c0983a35a9168d7ec59b46bbd2b07061260f72bd /client/main.c | |
parent | e8b9e6e330876c7cb16fb921aaefff3f786445b5 (diff) | |
download | bluez-d45b4ac3ecf3f2f7703384e00e4275fcca6cd793.tar.gz |
client/main: add help option for available args
This option exists to facilitate external completion of commands that
have specially defined arguments. It effectively adds two new commands
to bluetoothctl with the following output:
$ bluetoothctl agent help
on
off
DisplayOnly
DisplayYesNo
KeyboardDisplay
KeyboardOnly
NoInputNoOutput
$ bluetoothctl advertise help
on
off
peripheral
broadcast
Shell completion scripts can then parse this output to provide
completions for those commands.
Diffstat (limited to 'client/main.c')
-rw-r--r-- | client/main.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/client/main.c b/client/main.c index 578b3c7c3..68dabda02 100644 --- a/client/main.c +++ b/client/main.c @@ -800,6 +800,13 @@ static gboolean parse_argument(int argc, char *argv[], const char **arg_table, { const char **opt; + if (!strcmp(argv[1], "help")) { + for (opt = arg_table; opt && *opt; opt++) + bt_shell_printf("%s\n", *opt); + bt_shell_noninteractive_quit(EXIT_SUCCESS); + return FALSE; + } + if (!strcmp(argv[1], "on") || !strcmp(argv[1], "yes")) { *value = TRUE; if (option) |