diff options
author | Thomas Adam <thomas@xteddy.org> | 2014-10-21 07:11:44 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2014-10-21 07:11:44 +0100 |
commit | 562af864bd8ab06c416075b5742ce3bbcf6d0610 (patch) | |
tree | 2c3900dd6b284aa52441c3fde9dfdf8383d87b54 /cmd-list-keys.c | |
parent | b6aef2490f086f3404f439308bb1746ec5134e9a (diff) | |
parent | 0a1a88d63caf3a0e8b4440686e73e1f0f690e03c (diff) | |
download | rtmux-562af864bd8ab06c416075b5742ce3bbcf6d0610.tar.gz rtmux-562af864bd8ab06c416075b5742ce3bbcf6d0610.tar.bz2 rtmux-562af864bd8ab06c416075b5742ce3bbcf6d0610.zip |
Merge branch 'obsd-master'
Conflicts:
Makefile
cmd-list-commands.c
cmd-suspend-client.c
job.c
tmux.h
xmalloc.c
Diffstat (limited to 'cmd-list-keys.c')
-rw-r--r-- | cmd-list-keys.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/cmd-list-keys.c b/cmd-list-keys.c index 615c5ce1..d609036b 100644 --- a/cmd-list-keys.c +++ b/cmd-list-keys.c @@ -27,14 +27,23 @@ */ 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", "t:", 0, 0, "[-t key-table]", 0, - NULL, + cmd_list_keys_exec +}; + +const struct cmd_entry cmd_list_commands_entry = { + "list-commands", "lscm", + "", 0, 0, + "", + 0, cmd_list_keys_exec }; @@ -48,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)); @@ -148,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; + const 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); +} |