diff --git a/src/shared/shell.c b/src/shared/shell.c
index eac654f..aa3e474 100644
--- a/src/shared/shell.c
+++ b/src/shared/shell.c
int argc;
char **argv;
bool mode;
+ bool zsh;
bool monitor;
int timeout;
struct io *input;
} data;
static void shell_print_menu(void);
+static void shell_print_menu_zsh_complete(void);
static void cmd_version(int argc, char *argv[])
{
if (!data.menu)
return;
+ if (data.zsh) {
+ shell_print_menu_zsh_complete();
+ return;
+ }
+
print_text(COLOR_HIGHLIGHT, "Menu %s:", data.menu->name);
print_text(COLOR_HIGHLIGHT, "Available commands:");
print_text(COLOR_HIGHLIGHT, "-------------------");
}
}
+static void shell_print_menu_zsh_complete(void)
+{
+ const struct bt_shell_menu_entry *entry;
+
+ for (entry = data.menu->entries; entry->cmd; entry++)
+ printf("%s:%s\n", entry->cmd, entry->desc ? : "");
+
+ for (entry = default_menu; entry->cmd; entry++) {
+ if (entry->exists && !entry->exists(data.menu))
+ continue;
+
+ printf("%s:%s\n", entry->cmd, entry->desc ? : "");
+ }
+}
+
static int parse_args(char *arg, wordexp_t *w, char *del, int flags)
{
char *str;
{ "help", no_argument, 0, 'h' },
{ "timeout", required_argument, 0, 't' },
{ "monitor", no_argument, 0, 'm' },
+ { "zsh-complete", no_argument, 0, 'z' },
};
static void usage(int argc, char **argv, const struct bt_shell_opt *opt)
case 't':
data.timeout = atoi(optarg);
break;
+ case 'z':
+ data.zsh = 1;
+ break;
case 'm':
data.monitor = true;
if (bt_log_open() < 0) {