diff options
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/Makefile | 3 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-list-commands.c | 10 | ||||
-rw-r--r-- | usr.bin/tmux/cmd-list-keys.c | 34 |
3 files changed, 35 insertions, 12 deletions
diff --git a/usr.bin/tmux/Makefile b/usr.bin/tmux/Makefile index 538022e758d..1d31f72927f 100644 --- a/usr.bin/tmux/Makefile +++ b/usr.bin/tmux/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.71 2014/04/16 21:02:41 nicm Exp $ +# $OpenBSD: Makefile,v 1.72 2014/10/20 22:44:30 nicm Exp $ PROG= tmux SRCS= arguments.c \ @@ -32,7 +32,6 @@ SRCS= arguments.c \ cmd-link-window.c \ cmd-list-buffers.c \ cmd-list-clients.c \ - cmd-list-commands.c \ cmd-list-keys.c \ cmd-list-panes.c \ cmd-list-sessions.c \ diff --git a/usr.bin/tmux/cmd-list-commands.c b/usr.bin/tmux/cmd-list-commands.c index 36eca45c84a..316a5178780 100644 --- a/usr.bin/tmux/cmd-list-commands.c +++ b/usr.bin/tmux/cmd-list-commands.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-commands.c,v 1.12 2014/10/20 22:29:25 nicm Exp $ */ +/* $OpenBSD: cmd-list-commands.c,v 1.13 2014/10/20 22:44:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -26,14 +26,6 @@ enum cmd_retval cmd_list_commands_exec(struct cmd *, struct cmd_q *); -const struct cmd_entry cmd_list_commands_entry = { - "list-commands", "lscm", - "", 0, 0, - "", - 0, - cmd_list_commands_exec -}; - enum cmd_retval cmd_list_commands_exec(unused struct cmd *self, struct cmd_q *cmdq) { diff --git a/usr.bin/tmux/cmd-list-keys.c b/usr.bin/tmux/cmd-list-keys.c index 39f7dbdfeed..282549f430d 100644 --- a/usr.bin/tmux/cmd-list-keys.c +++ b/usr.bin/tmux/cmd-list-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-list-keys.c,v 1.23 2014/10/20 22:29:25 nicm Exp $ */ +/* $OpenBSD: cmd-list-keys.c,v 1.24 2014/10/20 22:44:30 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -27,7 +27,9 @@ */ enum cmd_retval cmd_list_keys_exec(struct cmd *, struct cmd_q *); + enum cmd_retval cmd_list_keys_table(struct cmd *, struct cmd_q *); +enum cmd_retval cmd_list_keys_commands(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_list_keys_entry = { "list-keys", "lsk", @@ -37,6 +39,14 @@ const struct cmd_entry cmd_list_keys_entry = { cmd_list_keys_exec }; +const struct cmd_entry cmd_list_commands_entry = { + "list-commands", "lscm", + "", 0, 0, + "", + 0, + cmd_list_keys_exec +}; + enum cmd_retval cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq) { @@ -47,6 +57,9 @@ cmd_list_keys_exec(struct cmd *self, struct cmd_q *cmdq) size_t used; int width, keywidth; + if (self->entry == &cmd_list_commands_entry) + return (cmd_list_keys_commands(self, cmdq)); + if (args_has(args, 't')) return (cmd_list_keys_table(self, cmdq)); @@ -147,3 +160,22 @@ cmd_list_keys_table(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } + +enum cmd_retval +cmd_list_keys_commands(unused struct cmd *self, struct cmd_q *cmdq) +{ + const struct cmd_entry **entryp; + struct cmd_entry *entry; + + for (entryp = cmd_table; *entryp != NULL; entryp++) { + entry = *entryp; + if (entry->alias == NULL) { + cmdq_print(cmdq, "%s %s", entry->name, entry->usage); + continue; + } + cmdq_print(cmdq, "%s (%s) %s", entry->name, entry->alias, + entry->usage); + } + + return (CMD_RETURN_NORMAL); +} |