diff options
author | Thomas Adam <thomas@xteddy.org> | 2020-04-06 04:01:42 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2020-04-06 04:01:42 +0100 |
commit | 71ab50eddd98e1d149e1b22e74ae01a47f555a1a (patch) | |
tree | 8750e898f104285927af70832245ca2614ce574c /cmd-list-keys.c | |
parent | 450315aa74c9821ce1bc8c4d51f7ab4abf55993a (diff) | |
parent | fccce69cf08b220ecad690e22451afd487e4b639 (diff) | |
download | rtmux-71ab50eddd98e1d149e1b22e74ae01a47f555a1a.tar.gz rtmux-71ab50eddd98e1d149e1b22e74ae01a47f555a1a.tar.bz2 rtmux-71ab50eddd98e1d149e1b22e74ae01a47f555a1a.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-list-keys.c')
-rw-r--r-- | cmd-list-keys.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/cmd-list-keys.c b/cmd-list-keys.c index 34ed43bf..7e340516 100644 --- a/cmd-list-keys.c +++ b/cmd-list-keys.c @@ -47,8 +47,8 @@ const struct cmd_entry cmd_list_commands_entry = { .name = "list-commands", .alias = "lscm", - .args = { "F:", 0, 0 }, - .usage = "[-F format]", + .args = { "F:", 0, 1 }, + .usage = "[-F format] [command]", .flags = CMD_STARTSERVER|CMD_AFTERHOOK, .exec = cmd_list_keys_exec @@ -317,9 +317,12 @@ cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item) const struct cmd_entry **entryp; const struct cmd_entry *entry; struct format_tree *ft; - const char *template, *s; + const char *template, *s, *command = NULL; char *line; + if (args->argc != 0) + command = args->argv[0]; + if ((template = args_get(args, 'F')) == NULL) { template = "#{command_list_name}" "#{?command_list_alias, (#{command_list_alias}),} " @@ -331,6 +334,11 @@ cmd_list_keys_commands(struct cmd *self, struct cmdq_item *item) for (entryp = cmd_table; *entryp != NULL; entryp++) { entry = *entryp; + if (command != NULL && + (strcmp(entry->name, command) != 0 && + (entry->alias == NULL || + strcmp(entry->alias, command) != 0))) + continue; format_add(ft, "command_list_name", "%s", entry->name); if (entry->alias != NULL) |