From ecfeee2e8255a77f82a07124c93c8dbc7683c421 Mon Sep 17 00:00:00 2001 From: nicm Date: Sun, 13 Dec 2015 21:53:57 +0000 Subject: [PATCH] Use member names in cmd_entry definitions so I stop getting confused about the order. --- cmd-attach-session.c | 13 +++++++---- cmd-bind-key.c | 14 ++++++++---- cmd-break-pane.c | 13 +++++++---- cmd-capture-pane.c | 15 +++++++----- cmd-choose-buffer.c | 13 +++++++---- cmd-choose-client.c | 13 +++++++---- cmd-choose-tree.c | 42 +++++++++++++++++++++------------- cmd-clear-history.c | 13 +++++++---- cmd-command-prompt.c | 14 ++++++++---- cmd-confirm-before.c | 13 +++++++---- cmd-copy-mode.c | 26 +++++++++++++-------- cmd-detach-client.c | 26 +++++++++++++-------- cmd-display-message.c | 15 +++++++----- cmd-display-panes.c | 13 +++++++---- cmd-find-window.c | 13 +++++++---- cmd-if-shell.c | 14 ++++++++---- cmd-join-pane.c | 26 +++++++++++++-------- cmd-kill-pane.c | 13 +++++++---- cmd-kill-server.c | 26 +++++++++++++-------- cmd-kill-session.c | 13 +++++++---- cmd-kill-window.c | 26 +++++++++++++-------- cmd-list-buffers.c | 13 +++++++---- cmd-list-clients.c | 13 +++++++---- cmd-list-keys.c | 26 +++++++++++++-------- cmd-list-panes.c | 13 +++++++---- cmd-list-sessions.c | 13 +++++++---- cmd-list-windows.c | 13 +++++++---- cmd-load-buffer.c | 13 +++++++---- cmd-lock-server.c | 39 +++++++++++++++++++------------ cmd-move-window.c | 26 +++++++++++++-------- cmd-new-session.c | 30 ++++++++++++++---------- cmd-new-window.c | 15 +++++++----- cmd-paste-buffer.c | 14 ++++++++---- cmd-pipe-pane.c | 13 +++++++---- cmd-refresh-client.c | 13 +++++++---- cmd-rename-session.c | 13 +++++++---- cmd-rename-window.c | 13 +++++++---- cmd-resize-pane.c | 14 ++++++++---- cmd-respawn-pane.c | 13 +++++++---- cmd-respawn-window.c | 13 +++++++---- cmd-rotate-window.c | 13 +++++++---- cmd-run-shell.c | 13 +++++++---- cmd-save-buffer.c | 26 +++++++++++++-------- cmd-select-layout.c | 39 +++++++++++++++++++------------ cmd-select-pane.c | 26 +++++++++++++-------- cmd-select-window.c | 52 ++++++++++++++++++++++++++---------------- cmd-send-keys.c | 26 +++++++++++++-------- cmd-set-buffer.c | 26 +++++++++++++-------- cmd-set-environment.c | 13 +++++++---- cmd-set-hook.c | 26 +++++++++++++-------- cmd-set-option.c | 26 +++++++++++++-------- cmd-show-environment.c | 13 +++++++---- cmd-show-messages.c | 26 +++++++++++++-------- cmd-show-options.c | 26 +++++++++++++-------- cmd-source-file.c | 13 +++++++---- cmd-split-window.c | 15 +++++++----- cmd-swap-pane.c | 13 +++++++---- cmd-swap-window.c | 13 +++++++---- cmd-switch-client.c | 16 ++++++++----- cmd-unbind-key.c | 13 +++++++---- cmd-wait-for.c | 13 +++++++---- cmd.c | 6 ++--- tmux.h | 18 ++++++++------- 63 files changed, 716 insertions(+), 449 deletions(-) diff --git a/cmd-attach-session.c b/cmd-attach-session.c index c29e9d1a..976f180b 100644 --- a/cmd-attach-session.c +++ b/cmd-attach-session.c @@ -33,11 +33,14 @@ enum cmd_retval cmd_attach_session_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_attach_session_entry = { - "attach-session", "attach", - "c:dErt:", 0, 0, - "[-dEr] [-c working-directory] " CMD_TARGET_SESSION_USAGE, - CMD_STARTSERVER|CMD_SESSION_T|CMD_PANE_T|CMD_PREFERUNATTACHED, - cmd_attach_session_exec + .name = "attach-session", + .alias = "attach", + + .args = { "c:dErt:", 0, 0 }, + .usage = "[-dEr] [-c working-directory] " CMD_TARGET_SESSION_USAGE, + + .flags = CMD_STARTSERVER|CMD_SESSION_T|CMD_PANE_T|CMD_PREFERUNATTACHED, + .exec = cmd_attach_session_exec }; enum cmd_retval diff --git a/cmd-bind-key.c b/cmd-bind-key.c index b13409cb..df3285f7 100644 --- a/cmd-bind-key.c +++ b/cmd-bind-key.c @@ -33,11 +33,15 @@ enum cmd_retval cmd_bind_key_mode_table(struct cmd *, struct cmd_q *, key_code); const struct cmd_entry cmd_bind_key_entry = { - "bind-key", "bind", - "cnrt:T:", 1, -1, - "[-cnr] [-t mode-table] [-T key-table] key command [arguments]", - 0, - cmd_bind_key_exec + .name = "bind-key", + .alias = "bind", + + .args = { "cnrt:T:", 1, -1 }, + .usage = "[-cnr] [-t mode-table] [-T key-table] key command " + "[arguments]", + + .flags = 0, + .exec = cmd_bind_key_exec }; enum cmd_retval diff --git a/cmd-break-pane.c b/cmd-break-pane.c index eb07fb87..62625c71 100644 --- a/cmd-break-pane.c +++ b/cmd-break-pane.c @@ -31,11 +31,14 @@ enum cmd_retval cmd_break_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_break_pane_entry = { - "break-pane", "breakp", - "dPF:s:t:", 0, 0, - "[-dP] [-F format] " CMD_SRCDST_PANE_USAGE, - CMD_PANE_S|CMD_INDEX_T, - cmd_break_pane_exec + .name = "break-pane", + .alias = "breakp", + + .args = { "dPF:s:t:", 0, 0 }, + .usage = "[-dP] [-F format] " CMD_SRCDST_PANE_USAGE, + + .flags = CMD_PANE_S|CMD_INDEX_T, + .exec = cmd_break_pane_exec }; enum cmd_retval diff --git a/cmd-capture-pane.c b/cmd-capture-pane.c index 9d22a0f2..0e3644e9 100644 --- a/cmd-capture-pane.c +++ b/cmd-capture-pane.c @@ -36,12 +36,15 @@ char *cmd_capture_pane_history(struct args *, struct cmd_q *, struct window_pane *, size_t *); const struct cmd_entry cmd_capture_pane_entry = { - "capture-pane", "capturep", - "ab:CeE:JpPqS:t:", 0, 0, - "[-aCeJpPq] " CMD_BUFFER_USAGE " [-E end-line] [-S start-line]" - CMD_TARGET_PANE_USAGE, - CMD_PANE_T, - cmd_capture_pane_exec + .name = "capture-pane", + .alias = "capturep", + + .args = { "ab:CeE:JpPqS:t:", 0, 0 }, + .usage = "[-aCeJpPq] " CMD_BUFFER_USAGE " [-E end-line] " + "[-S start-line]" CMD_TARGET_PANE_USAGE, + + .flags = CMD_PANE_T, + .exec = cmd_capture_pane_exec }; char * diff --git a/cmd-choose-buffer.c b/cmd-choose-buffer.c index 4418d415..fac792e9 100644 --- a/cmd-choose-buffer.c +++ b/cmd-choose-buffer.c @@ -33,11 +33,14 @@ enum cmd_retval cmd_choose_buffer_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_choose_buffer_entry = { - "choose-buffer", NULL, - "F:t:", 0, 1, - CMD_TARGET_WINDOW_USAGE " [-F format] [template]", - CMD_WINDOW_T, - cmd_choose_buffer_exec + .name = "choose-buffer", + .alias = NULL, + + .args = { "F:t:", 0, 1 }, + .usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]", + + .flags = CMD_WINDOW_T, + .exec = cmd_choose_buffer_exec }; enum cmd_retval diff --git a/cmd-choose-client.c b/cmd-choose-client.c index c58bc826..ab0f6c50 100644 --- a/cmd-choose-client.c +++ b/cmd-choose-client.c @@ -38,11 +38,14 @@ enum cmd_retval cmd_choose_client_exec(struct cmd *, struct cmd_q *); void cmd_choose_client_callback(struct window_choose_data *); const struct cmd_entry cmd_choose_client_entry = { - "choose-client", NULL, - "F:t:", 0, 1, - CMD_TARGET_WINDOW_USAGE " [-F format] [template]", - CMD_WINDOW_T, - cmd_choose_client_exec + .name = "choose-client", + .alias = NULL, + + .args = { "F:t:", 0, 1 }, + .usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]", + + .flags = CMD_WINDOW_T, + .exec = cmd_choose_client_exec }; struct cmd_choose_client_data { diff --git a/cmd-choose-tree.c b/cmd-choose-tree.c index 766978fe..faa9150c 100644 --- a/cmd-choose-tree.c +++ b/cmd-choose-tree.c @@ -44,28 +44,38 @@ enum cmd_retval cmd_choose_tree_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_choose_tree_entry = { - "choose-tree", NULL, - "S:W:swub:c:t:", 0, 1, - "[-suw] [-b session-template] [-c window template] [-S format] " \ - "[-W format] " CMD_TARGET_WINDOW_USAGE, - CMD_WINDOW_T, - cmd_choose_tree_exec + .name = "choose-tree", + .alias = NULL, + + .args = { "S:W:swub:c:t:", 0, 1 }, + .usage = "[-suw] [-b session-template] [-c window template] " + "[-S format] [-W format] " CMD_TARGET_WINDOW_USAGE, + + .flags = CMD_WINDOW_T, + .exec = cmd_choose_tree_exec }; const struct cmd_entry cmd_choose_session_entry = { - "choose-session", NULL, - "F:t:", 0, 1, - CMD_TARGET_WINDOW_USAGE " [-F format] [template]", - CMD_WINDOW_T, - cmd_choose_tree_exec + .name = "choose-session", + .alias = NULL, + + .args = { "F:t:", 0, 1 }, + + .usage = CMD_TARGET_WINDOW_USAGE " [-F format] [template]", + .flags = CMD_WINDOW_T, + + .exec = cmd_choose_tree_exec }; const struct cmd_entry cmd_choose_window_entry = { - "choose-window", NULL, - "F:t:", 0, 1, - CMD_TARGET_WINDOW_USAGE "[-F format] [template]", - CMD_WINDOW_T, - cmd_choose_tree_exec + .name = "choose-window", + .alias = NULL, + + .args = { "F:t:", 0, 1 }, + .usage = CMD_TARGET_WINDOW_USAGE "[-F format] [template]", + + .flags = CMD_WINDOW_T, + .exec = cmd_choose_tree_exec }; enum cmd_retval diff --git a/cmd-clear-history.c b/cmd-clear-history.c index a76cab80..a8c2bfdc 100644 --- a/cmd-clear-history.c +++ b/cmd-clear-history.c @@ -27,11 +27,14 @@ enum cmd_retval cmd_clear_history_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_clear_history_entry = { - "clear-history", "clearhist", - "t:", 0, 0, - CMD_TARGET_PANE_USAGE, - CMD_PANE_T, - cmd_clear_history_exec + .name = "clear-history", + .alias = "clearhist", + + .args = { "t:", 0, 0 }, + .usage = CMD_TARGET_PANE_USAGE, + + .flags = CMD_PANE_T, + .exec = cmd_clear_history_exec }; enum cmd_retval diff --git a/cmd-command-prompt.c b/cmd-command-prompt.c index 900fceb9..64b24bb5 100644 --- a/cmd-command-prompt.c +++ b/cmd-command-prompt.c @@ -35,11 +35,15 @@ int cmd_command_prompt_callback(void *, const char *); void cmd_command_prompt_free(void *); const struct cmd_entry cmd_command_prompt_entry = { - "command-prompt", NULL, - "I:p:t:", 0, 1, - "[-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " [template]", - CMD_CLIENT_T, - cmd_command_prompt_exec + .name = "command-prompt", + .alias = NULL, + + .args = { "I:p:t:", 0, 1 }, + .usage = "[-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " " + "[template]", + + .flags = CMD_CLIENT_T, + .exec = cmd_command_prompt_exec }; struct cmd_command_prompt_cdata { diff --git a/cmd-confirm-before.c b/cmd-confirm-before.c index 17a575a2..90e16992 100644 --- a/cmd-confirm-before.c +++ b/cmd-confirm-before.c @@ -34,11 +34,14 @@ int cmd_confirm_before_callback(void *, const char *); void cmd_confirm_before_free(void *); const struct cmd_entry cmd_confirm_before_entry = { - "confirm-before", "confirm", - "p:t:", 1, 1, - "[-p prompt] " CMD_TARGET_CLIENT_USAGE " command", - CMD_CLIENT_T, - cmd_confirm_before_exec + .name = "confirm-before", + .alias = "confirm", + + .args = { "p:t:", 1, 1 }, + .usage = "[-p prompt] " CMD_TARGET_CLIENT_USAGE " command", + + .flags = CMD_CLIENT_T, + .exec = cmd_confirm_before_exec }; struct cmd_confirm_before_data { diff --git a/cmd-copy-mode.c b/cmd-copy-mode.c index 79d06cee..7c6f6ca7 100644 --- a/cmd-copy-mode.c +++ b/cmd-copy-mode.c @@ -27,19 +27,25 @@ enum cmd_retval cmd_copy_mode_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_copy_mode_entry = { - "copy-mode", NULL, - "Met:u", 0, 0, - "[-Mu] " CMD_TARGET_PANE_USAGE, - CMD_PANE_T, - cmd_copy_mode_exec + .name = "copy-mode", + .alias = NULL, + + .args = { "Met:u", 0, 0 }, + .usage = "[-Mu] " CMD_TARGET_PANE_USAGE, + + .flags = CMD_PANE_T, + .exec = cmd_copy_mode_exec }; const struct cmd_entry cmd_clock_mode_entry = { - "clock-mode", NULL, - "t:", 0, 0, - CMD_TARGET_PANE_USAGE, - 0, - cmd_copy_mode_exec + .name = "clock-mode", + .alias = NULL, + + .args = { "t:", 0, 0 }, + .usage = CMD_TARGET_PANE_USAGE, + + .flags = 0, + .exec = cmd_copy_mode_exec }; enum cmd_retval diff --git a/cmd-detach-client.c b/cmd-detach-client.c index 86f8063c..6f6adbb9 100644 --- a/cmd-detach-client.c +++ b/cmd-detach-client.c @@ -29,19 +29,25 @@ enum cmd_retval cmd_detach_client_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_detach_client_entry = { - "detach-client", "detach", - "as:t:P", 0, 0, - "[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE, - CMD_READONLY|CMD_CLIENT_T|CMD_SESSION_S, - cmd_detach_client_exec + .name = "detach-client", + .alias = "detach", + + .args = { "as:t:P", 0, 0 }, + .usage = "[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE, + + .flags = CMD_READONLY|CMD_CLIENT_T|CMD_SESSION_S, + .exec = cmd_detach_client_exec }; const struct cmd_entry cmd_suspend_client_entry = { - "suspend-client", "suspendc", - "t:", 0, 0, - CMD_TARGET_CLIENT_USAGE, - CMD_CLIENT_T, - cmd_detach_client_exec + .name = "suspend-client", + .alias = "suspendc", + + .args = { "t:", 0, 0 }, + .usage = CMD_TARGET_CLIENT_USAGE, + + .flags = CMD_CLIENT_T, + .exec = cmd_detach_client_exec }; enum cmd_retval diff --git a/cmd-display-message.c b/cmd-display-message.c index ddc55846..fdfa6ae2 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -35,12 +35,15 @@ enum cmd_retval cmd_display_message_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_display_message_entry = { - "display-message", "display", - "c:pt:F:", 0, 1, - "[-p] [-c target-client] [-F format] " CMD_TARGET_PANE_USAGE - " [message]", - CMD_CLIENT_C|CMD_PANE_T|CMD_CLIENT_CANFAIL, - cmd_display_message_exec + .name = "display-message", + .alias = "display", + + .args = { "c:pt:F:", 0, 1 }, + .usage = "[-p] [-c target-client] [-F format] " + CMD_TARGET_PANE_USAGE " [message]", + + .flags = CMD_CLIENT_C|CMD_PANE_T|CMD_CLIENT_CANFAIL, + .exec = cmd_display_message_exec }; enum cmd_retval diff --git a/cmd-display-panes.c b/cmd-display-panes.c index 714ee19e..db1e4b08 100644 --- a/cmd-display-panes.c +++ b/cmd-display-panes.c @@ -27,11 +27,14 @@ enum cmd_retval cmd_display_panes_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_display_panes_entry = { - "display-panes", "displayp", - "t:", 0, 0, - CMD_TARGET_CLIENT_USAGE, - CMD_CLIENT_T, - cmd_display_panes_exec + .name = "display-panes", + .alias = "displayp", + + .args = { "t:", 0, 0 }, + .usage = CMD_TARGET_CLIENT_USAGE, + + .flags = CMD_CLIENT_T, + .exec = cmd_display_panes_exec }; enum cmd_retval diff --git a/cmd-find-window.c b/cmd-find-window.c index 1733b717..9c31cc0e 100644 --- a/cmd-find-window.c +++ b/cmd-find-window.c @@ -48,11 +48,14 @@ void cmd_find_window_callback(struct window_choose_data *); CMD_FIND_WINDOW_BY_NAME) const struct cmd_entry cmd_find_window_entry = { - "find-window", "findw", - "F:CNt:T", 1, 4, - "[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string", - CMD_WINDOW_T, - cmd_find_window_exec + .name = "find-window", + .alias = "findw", + + .args = { "F:CNt:T", 1, 4 }, + .usage = "[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string", + + .flags = CMD_WINDOW_T, + .exec = cmd_find_window_exec }; struct cmd_find_window_data { diff --git a/cmd-if-shell.c b/cmd-if-shell.c index 404f4671..4c2cacb1 100644 --- a/cmd-if-shell.c +++ b/cmd-if-shell.c @@ -36,11 +36,15 @@ void cmd_if_shell_done(struct cmd_q *); void cmd_if_shell_free(void *); const struct cmd_entry cmd_if_shell_entry = { - "if-shell", "if", - "bFt:", 2, 3, - "[-bF] " CMD_TARGET_PANE_USAGE " shell-command command [command]", - CMD_PANE_T|CMD_CANFAIL, - cmd_if_shell_exec + .name = "if-shell", + .alias = "if", + + .args = { "bFt:", 2, 3 }, + .usage = "[-bF] " CMD_TARGET_PANE_USAGE " shell-command command " + "[command]", + + .flags = CMD_PANE_T|CMD_CANFAIL, + .exec = cmd_if_shell_exec }; struct cmd_if_shell_data { diff --git a/cmd-join-pane.c b/cmd-join-pane.c index 6fc5b977..e5fbb423 100644 --- a/cmd-join-pane.c +++ b/cmd-join-pane.c @@ -34,19 +34,25 @@ enum cmd_retval cmd_join_pane_exec(struct cmd *, struct cmd_q *); enum cmd_retval join_pane(struct cmd *, struct cmd_q *, int); const struct cmd_entry cmd_join_pane_entry = { - "join-pane", "joinp", - "bdhvp:l:s:t:", 0, 0, - "[-bdhv] [-p percentage|-l size] " CMD_SRCDST_PANE_USAGE, - CMD_PANE_MARKED_S|CMD_PANE_T, - cmd_join_pane_exec + .name = "join-pane", + .alias = "joinp", + + .args = { "bdhvp:l:s:t:", 0, 0 }, + .usage = "[-bdhv] [-p percentage|-l size] " CMD_SRCDST_PANE_USAGE, + + .flags = CMD_PANE_MARKED_S|CMD_PANE_T, + .exec = cmd_join_pane_exec }; const struct cmd_entry cmd_move_pane_entry = { - "move-pane", "movep", - "bdhvp:l:s:t:", 0, 0, - "[-bdhv] [-p percentage|-l size] " CMD_SRCDST_PANE_USAGE, - CMD_PANE_S|CMD_PANE_T, - cmd_join_pane_exec + .name = "move-pane", + .alias = "movep", + + .args = { "bdhvp:l:s:t:", 0, 0 }, + .usage = "[-bdhv] [-p percentage|-l size] " CMD_SRCDST_PANE_USAGE, + + .flags = CMD_PANE_S|CMD_PANE_T, + .exec = cmd_join_pane_exec }; enum cmd_retval diff --git a/cmd-kill-pane.c b/cmd-kill-pane.c index d5f69ea9..3e558d7d 100644 --- a/cmd-kill-pane.c +++ b/cmd-kill-pane.c @@ -29,11 +29,14 @@ enum cmd_retval cmd_kill_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_kill_pane_entry = { - "kill-pane", "killp", - "at:", 0, 0, - "[-a] " CMD_TARGET_PANE_USAGE, - CMD_PANE_T, - cmd_kill_pane_exec + .name = "kill-pane", + .alias = "killp", + + .args = { "at:", 0, 0 }, + .usage = "[-a] " CMD_TARGET_PANE_USAGE, + + .flags = CMD_PANE_T, + .exec = cmd_kill_pane_exec }; enum cmd_retval diff --git a/cmd-kill-server.c b/cmd-kill-server.c index 4107e6b6..6f84e959 100644 --- a/cmd-kill-server.c +++ b/cmd-kill-server.c @@ -30,19 +30,25 @@ enum cmd_retval cmd_kill_server_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_kill_server_entry = { - "kill-server", NULL, - "", 0, 0, - "", - 0, - cmd_kill_server_exec + .name = "kill-server", + .alias = NULL, + + .args = { "", 0, 0 }, + .usage = "", + + .flags = 0, + .exec = cmd_kill_server_exec }; const struct cmd_entry cmd_start_server_entry = { - "start-server", "start", - "", 0, 0, - "", - CMD_STARTSERVER, - cmd_kill_server_exec + .name = "start-server", + .alias = "start", + + .args = { "", 0, 0 }, + .usage = "", + + .flags = CMD_STARTSERVER, + .exec = cmd_kill_server_exec }; enum cmd_retval diff --git a/cmd-kill-session.c b/cmd-kill-session.c index a4b0d5d2..a8d2d996 100644 --- a/cmd-kill-session.c +++ b/cmd-kill-session.c @@ -30,11 +30,14 @@ enum cmd_retval cmd_kill_session_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_kill_session_entry = { - "kill-session", NULL, - "aCt:", 0, 0, - "[-aC] " CMD_TARGET_SESSION_USAGE, - CMD_SESSION_T, - cmd_kill_session_exec + .name = "kill-session", + .alias = NULL, + + .args = { "aCt:", 0, 0 }, + .usage = "[-aC] " CMD_TARGET_SESSION_USAGE, + + .flags = CMD_SESSION_T, + .exec = cmd_kill_session_exec }; enum cmd_retval diff --git a/cmd-kill-window.c b/cmd-kill-window.c index 4ab17472..b8e1d5bc 100644 --- a/cmd-kill-window.c +++ b/cmd-kill-window.c @@ -27,19 +27,25 @@ enum cmd_retval cmd_kill_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_kill_window_entry = { - "kill-window", "killw", - "at:", 0, 0, - "[-a] " CMD_TARGET_WINDOW_USAGE, - CMD_WINDOW_T, - cmd_kill_window_exec + .name = "kill-window", + .alias = "killw", + + .args = { "at:", 0, 0 }, + .usage = "[-a] " CMD_TARGET_WINDOW_USAGE, + + .flags = CMD_WINDOW_T, + .exec = cmd_kill_window_exec }; const struct cmd_entry cmd_unlink_window_entry = { - "unlink-window", "unlinkw", - "kt:", 0, 0, - "[-k] " CMD_TARGET_WINDOW_USAGE, - CMD_WINDOW_T, - cmd_kill_window_exec + .name = "unlink-window", + .alias = "unlinkw", + + .args = { "kt:", 0, 0 }, + .usage = "[-k] " CMD_TARGET_WINDOW_USAGE, + + .flags = CMD_WINDOW_T, + .exec = cmd_kill_window_exec }; enum cmd_retval diff --git a/cmd-list-buffers.c b/cmd-list-buffers.c index 218eb6ff..a6007c33 100644 --- a/cmd-list-buffers.c +++ b/cmd-list-buffers.c @@ -33,11 +33,14 @@ enum cmd_retval cmd_list_buffers_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_list_buffers_entry = { - "list-buffers", "lsb", - "F:", 0, 0, - "[-F format]", - 0, - cmd_list_buffers_exec + .name = "list-buffers", + .alias = "lsb", + + .args = { "F:", 0, 0 }, + .usage = "[-F format]", + + .flags = 0, + .exec = cmd_list_buffers_exec }; enum cmd_retval diff --git a/cmd-list-clients.c b/cmd-list-clients.c index effd8275..8a6fe8a9 100644 --- a/cmd-list-clients.c +++ b/cmd-list-clients.c @@ -36,11 +36,14 @@ enum cmd_retval cmd_list_clients_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_list_clients_entry = { - "list-clients", "lsc", - "F:t:", 0, 0, - "[-F format] " CMD_TARGET_SESSION_USAGE, - CMD_READONLY|CMD_SESSION_T, - cmd_list_clients_exec + .name = "list-clients", + .alias = "lsc", + + .args = { "F:t:", 0, 0 }, + .usage = "[-F format] " CMD_TARGET_SESSION_USAGE, + + .flags = CMD_READONLY|CMD_SESSION_T, + .exec = cmd_list_clients_exec }; enum cmd_retval diff --git a/cmd-list-keys.c b/cmd-list-keys.c index f0a59c0b..08796e5d 100644 --- a/cmd-list-keys.c +++ b/cmd-list-keys.c @@ -33,19 +33,25 @@ enum cmd_retval cmd_list_keys_table(struct cmd *, struct cmd_q *); enum cmd_retval cmd_list_keys_commands(struct cmd_q *); const struct cmd_entry cmd_list_keys_entry = { - "list-keys", "lsk", - "t:T:", 0, 0, - "[-t mode-table] [-T key-table]", - 0, - cmd_list_keys_exec + .name = "list-keys", + .alias = "lsk", + + .args = { "t:T:", 0, 0 }, + .usage = "[-t mode-table] [-T key-table]", + + .flags = 0, + .exec = cmd_list_keys_exec }; const struct cmd_entry cmd_list_commands_entry = { - "list-commands", "lscm", - "", 0, 0, - "", - 0, - cmd_list_keys_exec + .name = "list-commands", + .alias = "lscm", + + .args = { "", 0, 0 }, + .usage = "", + + .flags = 0, + .exec = cmd_list_keys_exec }; enum cmd_retval diff --git a/cmd-list-panes.c b/cmd-list-panes.c index 2c9fa623..9f675b76 100644 --- a/cmd-list-panes.c +++ b/cmd-list-panes.c @@ -35,11 +35,14 @@ void cmd_list_panes_window(struct cmd *, struct session *, struct winlink *, struct cmd_q *, int); const struct cmd_entry cmd_list_panes_entry = { - "list-panes", "lsp", - "asF:t:", 0, 0, - "[-as] [-F format] " CMD_TARGET_WINDOW_USAGE, - CMD_WINDOW_T, - cmd_list_panes_exec + .name = "list-panes", + .alias = "lsp", + + .args = { "asF:t:", 0, 0 }, + .usage = "[-as] [-F format] " CMD_TARGET_WINDOW_USAGE, + + .flags = CMD_WINDOW_T, + .exec = cmd_list_panes_exec }; enum cmd_retval diff --git a/cmd-list-sessions.c b/cmd-list-sessions.c index fed0c2ee..1fde7f86 100644 --- a/cmd-list-sessions.c +++ b/cmd-list-sessions.c @@ -39,11 +39,14 @@ enum cmd_retval cmd_list_sessions_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_list_sessions_entry = { - "list-sessions", "ls", - "F:", 0, 0, - "[-F format]", - 0, - cmd_list_sessions_exec + .name = "list-sessions", + .alias = "ls", + + .args = { "F:", 0, 0 }, + .usage = "[-F format]", + + .flags = 0, + .exec = cmd_list_sessions_exec }; enum cmd_retval diff --git a/cmd-list-windows.c b/cmd-list-windows.c index 992ba0de..d34f8b8c 100644 --- a/cmd-list-windows.c +++ b/cmd-list-windows.c @@ -46,11 +46,14 @@ void cmd_list_windows_session(struct cmd *, struct session *, struct cmd_q *, int); const struct cmd_entry cmd_list_windows_entry = { - "list-windows", "lsw", - "F:at:", 0, 0, - "[-a] [-F format] " CMD_TARGET_SESSION_USAGE, - CMD_SESSION_T, - cmd_list_windows_exec + .name = "list-windows", + .alias = "lsw", + + .args = { "F:at:", 0, 0 }, + .usage = "[-a] [-F format] " CMD_TARGET_SESSION_USAGE, + + .flags = CMD_SESSION_T, + .exec = cmd_list_windows_exec }; enum cmd_retval diff --git a/cmd-load-buffer.c b/cmd-load-buffer.c index 929e3bf2..6fd2a767 100644 --- a/cmd-load-buffer.c +++ b/cmd-load-buffer.c @@ -35,11 +35,14 @@ enum cmd_retval cmd_load_buffer_exec(struct cmd *, struct cmd_q *); void cmd_load_buffer_callback(struct client *, int, void *); const struct cmd_entry cmd_load_buffer_entry = { - "load-buffer", "loadb", - "b:", 1, 1, - CMD_BUFFER_USAGE " path", - 0, - cmd_load_buffer_exec + .name = "load-buffer", + .alias = "loadb", + + .args = { "b:", 1, 1 }, + .usage = CMD_BUFFER_USAGE " path", + + .flags = 0, + .exec = cmd_load_buffer_exec }; enum cmd_retval diff --git a/cmd-lock-server.c b/cmd-lock-server.c index 5d20ebd4..777311b3 100644 --- a/cmd-lock-server.c +++ b/cmd-lock-server.c @@ -27,27 +27,36 @@ enum cmd_retval cmd_lock_server_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_lock_server_entry = { - "lock-server", "lock", - "", 0, 0, - "", - 0, - cmd_lock_server_exec + .name = "lock-server", + .alias = "lock", + + .args = { "", 0, 0 }, + .usage = "", + + .flags = 0, + .exec = cmd_lock_server_exec }; const struct cmd_entry cmd_lock_session_entry = { - "lock-session", "locks", - "t:", 0, 0, - CMD_TARGET_SESSION_USAGE, - CMD_SESSION_T, - cmd_lock_server_exec + .name = "lock-session", + .alias = "locks", + + .args = { "t:", 0, 0 }, + .usage = CMD_TARGET_SESSION_USAGE, + + .flags = CMD_SESSION_T, + .exec = cmd_lock_server_exec }; const struct cmd_entry cmd_lock_client_entry = { - "lock-client", "lockc", - "t:", 0, 0, - CMD_TARGET_CLIENT_USAGE, - CMD_CLIENT_T, - cmd_lock_server_exec + .name = "lock-client", + .alias = "lockc", + + .args = { "t:", 0, 0 }, + .usage = CMD_TARGET_CLIENT_USAGE, + + .flags = CMD_CLIENT_T, + .exec = cmd_lock_server_exec }; enum cmd_retval diff --git a/cmd-move-window.c b/cmd-move-window.c index 9e3a1c09..59a8538f 100644 --- a/cmd-move-window.c +++ b/cmd-move-window.c @@ -29,19 +29,25 @@ enum cmd_retval cmd_move_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_move_window_entry = { - "move-window", "movew", - "adkrs:t:", 0, 0, - "[-dkr] " CMD_SRCDST_WINDOW_USAGE, - CMD_WINDOW_S|CMD_MOVEW_R|CMD_INDEX_T, - cmd_move_window_exec + .name = "move-window", + .alias = "movew", + + .args = { "adkrs:t:", 0, 0 }, + .usage = "[-dkr] " CMD_SRCDST_WINDOW_USAGE, + + .flags = CMD_WINDOW_S|CMD_MOVEW_R|CMD_INDEX_T, + .exec = cmd_move_window_exec }; const struct cmd_entry cmd_link_window_entry = { - "link-window", "linkw", - "adks:t:", 0, 0, - "[-dk] " CMD_SRCDST_WINDOW_USAGE, - CMD_WINDOW_S|CMD_INDEX_T, - cmd_move_window_exec + .name = "link-window", + .alias = "linkw", + + .args = { "adks:t:", 0, 0 }, + .usage = "[-dk] " CMD_SRCDST_WINDOW_USAGE, + + .flags = CMD_WINDOW_S|CMD_INDEX_T, + .exec = cmd_move_window_exec }; enum cmd_retval diff --git a/cmd-new-session.c b/cmd-new-session.c index e589a361..3cc07f46 100644 --- a/cmd-new-session.c +++ b/cmd-new-session.c @@ -36,21 +36,27 @@ enum cmd_retval cmd_new_session_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_new_session_entry = { - "new-session", "new", - "Ac:dDEF:n:Ps:t:x:y:", 0, -1, - "[-AdDEP] [-c start-directory] [-F format] [-n window-name] " - "[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] " - "[-y height] [command]", - CMD_STARTSERVER|CMD_CANFAIL|CMD_SESSION_T, - cmd_new_session_exec + .name = "new-session", + .alias = "new", + + .args = { "Ac:dDEF:n:Ps:t:x:y:", 0, -1 }, + .usage = "[-AdDEP] [-c start-directory] [-F format] [-n window-name] " + "[-s session-name] " CMD_TARGET_SESSION_USAGE " [-x width] " + "[-y height] [command]", + + .flags = CMD_STARTSERVER|CMD_CANFAIL|CMD_SESSION_T, + .exec = cmd_new_session_exec }; const struct cmd_entry cmd_has_session_entry = { - "has-session", "has", - "t:", 0, 0, - CMD_TARGET_SESSION_USAGE, - CMD_SESSION_T, - cmd_new_session_exec + .name = "has-session", + .alias = "has", + + .args = { "t:", 0, 0 }, + .usage = CMD_TARGET_SESSION_USAGE, + + .flags = CMD_SESSION_T, + .exec = cmd_new_session_exec }; enum cmd_retval diff --git a/cmd-new-window.c b/cmd-new-window.c index 18d2952b..b7a9c2be 100644 --- a/cmd-new-window.c +++ b/cmd-new-window.c @@ -35,12 +35,15 @@ enum cmd_retval cmd_new_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_new_window_entry = { - "new-window", "neww", - "ac:dF:kn:Pt:", 0, -1, - "[-adkP] [-c start-directory] [-F format] [-n window-name] " - CMD_TARGET_WINDOW_USAGE " [command]", - CMD_INDEX_T, - cmd_new_window_exec + .name = "new-window", + .alias = "neww", + + .args = { "ac:dF:kn:Pt:", 0, -1 }, + .usage = "[-adkP] [-c start-directory] [-F format] [-n window-name] " + CMD_TARGET_WINDOW_USAGE " [command]", + + .flags = CMD_INDEX_T, + .exec = cmd_new_window_exec }; enum cmd_retval diff --git a/cmd-paste-buffer.c b/cmd-paste-buffer.c index 92a31c53..aa6e7805 100644 --- a/cmd-paste-buffer.c +++ b/cmd-paste-buffer.c @@ -34,11 +34,15 @@ void cmd_paste_buffer_filter(struct window_pane *, const char *, size_t, const char *, int); const struct cmd_entry cmd_paste_buffer_entry = { - "paste-buffer", "pasteb", - "db:prs:t:", 0, 0, - "[-dpr] [-s separator] " CMD_BUFFER_USAGE " " CMD_TARGET_PANE_USAGE, - CMD_PANE_T, - cmd_paste_buffer_exec + .name = "paste-buffer", + .alias = "pasteb", + + .args = { "db:prs:t:", 0, 0 }, + .usage = "[-dpr] [-s separator] " CMD_BUFFER_USAGE " " + CMD_TARGET_PANE_USAGE, + + .flags = CMD_PANE_T, + .exec = cmd_paste_buffer_exec }; enum cmd_retval diff --git a/cmd-pipe-pane.c b/cmd-pipe-pane.c index ad4b02e0..31b3a584 100644 --- a/cmd-pipe-pane.c +++ b/cmd-pipe-pane.c @@ -38,11 +38,14 @@ enum cmd_retval cmd_pipe_pane_exec(struct cmd *, struct cmd_q *); void cmd_pipe_pane_error_callback(struct bufferevent *, short, void *); const struct cmd_entry cmd_pipe_pane_entry = { - "pipe-pane", "pipep", - "ot:", 0, 1, - "[-o] " CMD_TARGET_PANE_USAGE " [command]", - CMD_PANE_T, - cmd_pipe_pane_exec + .name = "pipe-pane", + .alias = "pipep", + + .args = { "ot:", 0, 1 }, + .usage = "[-o] " CMD_TARGET_PANE_USAGE " [command]", + + .flags = CMD_PANE_T, + .exec = cmd_pipe_pane_exec }; enum cmd_retval diff --git a/cmd-refresh-client.c b/cmd-refresh-client.c index 9d1d0fce..2cf69ac5 100644 --- a/cmd-refresh-client.c +++ b/cmd-refresh-client.c @@ -27,11 +27,14 @@ enum cmd_retval cmd_refresh_client_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_refresh_client_entry = { - "refresh-client", "refresh", - "C:St:", 0, 0, - "[-S] [-C size] " CMD_TARGET_CLIENT_USAGE, - CMD_CLIENT_T, - cmd_refresh_client_exec + .name = "refresh-client", + .alias = "refresh", + + .args = { "C:St:", 0, 0 }, + .usage = "[-S] [-C size] " CMD_TARGET_CLIENT_USAGE, + + .flags = CMD_CLIENT_T, + .exec = cmd_refresh_client_exec }; enum cmd_retval diff --git a/cmd-rename-session.c b/cmd-rename-session.c index 0c1a7e8c..c145dcb4 100644 --- a/cmd-rename-session.c +++ b/cmd-rename-session.c @@ -29,11 +29,14 @@ enum cmd_retval cmd_rename_session_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_rename_session_entry = { - "rename-session", "rename", - "t:", 1, 1, - CMD_TARGET_SESSION_USAGE " new-name", - CMD_SESSION_T, - cmd_rename_session_exec + .name = "rename-session", + .alias = "rename", + + .args = { "t:", 1, 1 }, + .usage = CMD_TARGET_SESSION_USAGE " new-name", + + .flags = CMD_SESSION_T, + .exec = cmd_rename_session_exec }; enum cmd_retval diff --git a/cmd-rename-window.c b/cmd-rename-window.c index 6609ebab..6a61b486 100644 --- a/cmd-rename-window.c +++ b/cmd-rename-window.c @@ -29,11 +29,14 @@ enum cmd_retval cmd_rename_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_rename_window_entry = { - "rename-window", "renamew", - "t:", 1, 1, - CMD_TARGET_WINDOW_USAGE " new-name", - CMD_WINDOW_T, - cmd_rename_window_exec + .name = "rename-window", + .alias = "renamew", + + .args = { "t:", 1, 1 }, + .usage = CMD_TARGET_WINDOW_USAGE " new-name", + + .flags = CMD_WINDOW_T, + .exec = cmd_rename_window_exec }; enum cmd_retval diff --git a/cmd-resize-pane.c b/cmd-resize-pane.c index a4de32df..fb3302a2 100644 --- a/cmd-resize-pane.c +++ b/cmd-resize-pane.c @@ -31,11 +31,15 @@ enum cmd_retval cmd_resize_pane_exec(struct cmd *, struct cmd_q *); void cmd_resize_pane_mouse_update(struct client *, struct mouse_event *); const struct cmd_entry cmd_resize_pane_entry = { - "resize-pane", "resizep", - "DLMRt:Ux:y:Z", 0, 1, - "[-DLMRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " [adjustment]", - CMD_PANE_T, - cmd_resize_pane_exec + .name = "resize-pane", + .alias = "resizep", + + .args = { "DLMRt:Ux:y:Z", 0, 1 }, + .usage = "[-DLMRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " " + "[adjustment]", + + .flags = CMD_PANE_T, + .exec = cmd_resize_pane_exec }; enum cmd_retval diff --git a/cmd-respawn-pane.c b/cmd-respawn-pane.c index 45098d80..4a1ba60b 100644 --- a/cmd-respawn-pane.c +++ b/cmd-respawn-pane.c @@ -31,11 +31,14 @@ enum cmd_retval cmd_respawn_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_respawn_pane_entry = { - "respawn-pane", "respawnp", - "kt:", 0, -1, - "[-k] " CMD_TARGET_PANE_USAGE " [command]", - CMD_PANE_T, - cmd_respawn_pane_exec + .name = "respawn-pane", + .alias = "respawnp", + + .args = { "kt:", 0, -1 }, + .usage = "[-k] " CMD_TARGET_PANE_USAGE " [command]", + + .flags = CMD_PANE_T, + .exec = cmd_respawn_pane_exec }; enum cmd_retval diff --git a/cmd-respawn-window.c b/cmd-respawn-window.c index f6550dee..2b2a674f 100644 --- a/cmd-respawn-window.c +++ b/cmd-respawn-window.c @@ -30,11 +30,14 @@ enum cmd_retval cmd_respawn_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_respawn_window_entry = { - "respawn-window", "respawnw", - "kt:", 0, -1, - "[-k] " CMD_TARGET_WINDOW_USAGE " [command]", - CMD_WINDOW_T, - cmd_respawn_window_exec + .name = "respawn-window", + .alias = "respawnw", + + .args = { "kt:", 0, -1 }, + .usage = "[-k] " CMD_TARGET_WINDOW_USAGE " [command]", + + .flags = CMD_WINDOW_T, + .exec = cmd_respawn_window_exec }; enum cmd_retval diff --git a/cmd-rotate-window.c b/cmd-rotate-window.c index 4122886a..9966cff6 100644 --- a/cmd-rotate-window.c +++ b/cmd-rotate-window.c @@ -27,11 +27,14 @@ enum cmd_retval cmd_rotate_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_rotate_window_entry = { - "rotate-window", "rotatew", - "Dt:U", 0, 0, - "[-DU] " CMD_TARGET_WINDOW_USAGE, - CMD_WINDOW_T, - cmd_rotate_window_exec + .name = "rotate-window", + .alias = "rotatew", + + .args = { "Dt:U", 0, 0 }, + .usage = "[-DU] " CMD_TARGET_WINDOW_USAGE, + + .flags = CMD_WINDOW_T, + .exec = cmd_rotate_window_exec }; enum cmd_retval diff --git a/cmd-run-shell.c b/cmd-run-shell.c index 0dae39ac..d84c3899 100644 --- a/cmd-run-shell.c +++ b/cmd-run-shell.c @@ -36,11 +36,14 @@ void cmd_run_shell_free(void *); void cmd_run_shell_print(struct job *, const char *); const struct cmd_entry cmd_run_shell_entry = { - "run-shell", "run", - "bt:", 1, 1, - "[-b] " CMD_TARGET_PANE_USAGE " shell-command", - CMD_PANE_T|CMD_CANFAIL, - cmd_run_shell_exec + .name = "run-shell", + .alias = "run", + + .args = { "bt:", 1, 1 }, + .usage = "[-b] " CMD_TARGET_PANE_USAGE " shell-command", + + .flags = CMD_PANE_T|CMD_CANFAIL, + .exec = cmd_run_shell_exec }; struct cmd_run_shell_data { diff --git a/cmd-save-buffer.c b/cmd-save-buffer.c index fc8d7bee..591390b5 100644 --- a/cmd-save-buffer.c +++ b/cmd-save-buffer.c @@ -35,19 +35,25 @@ enum cmd_retval cmd_save_buffer_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_save_buffer_entry = { - "save-buffer", "saveb", - "ab:", 1, 1, - "[-a] " CMD_BUFFER_USAGE " path", - 0, - cmd_save_buffer_exec + .name = "save-buffer", + .alias = "saveb", + + .args = { "ab:", 1, 1 }, + .usage = "[-a] " CMD_BUFFER_USAGE " path", + + .flags = 0, + .exec = cmd_save_buffer_exec }; const struct cmd_entry cmd_show_buffer_entry = { - "show-buffer", "showb", - "b:", 0, 0, - CMD_BUFFER_USAGE, - 0, - cmd_save_buffer_exec + .name = "show-buffer", + .alias = "showb", + + .args = { "b:", 0, 0 }, + .usage = CMD_BUFFER_USAGE, + + .flags = 0, + .exec = cmd_save_buffer_exec }; enum cmd_retval diff --git a/cmd-select-layout.c b/cmd-select-layout.c index aac60083..5bc0daad 100644 --- a/cmd-select-layout.c +++ b/cmd-select-layout.c @@ -29,27 +29,36 @@ enum cmd_retval cmd_select_layout_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_select_layout_entry = { - "select-layout", "selectl", - "nopt:", 0, 1, - "[-nop] " CMD_TARGET_WINDOW_USAGE " [layout-name]", - CMD_WINDOW_T, - cmd_select_layout_exec + .name = "select-layout", + .alias = "selectl", + + .args = { "nopt:", 0, 1 }, + .usage = "[-nop] " CMD_TARGET_WINDOW_USAGE " [layout-name]", + + .flags = CMD_WINDOW_T, + .exec = cmd_select_layout_exec }; const struct cmd_entry cmd_next_layout_entry = { - "next-layout", "nextl", - "t:", 0, 0, - CMD_TARGET_WINDOW_USAGE, - CMD_WINDOW_T, - cmd_select_layout_exec + .name = "next-layout", + .alias = "nextl", + + .args = { "t:", 0, 0 }, + .usage = CMD_TARGET_WINDOW_USAGE, + + .flags = CMD_WINDOW_T, + .exec = cmd_select_layout_exec }; const struct cmd_entry cmd_previous_layout_entry = { - "previous-layout", "prevl", - "t:", 0, 0, - CMD_TARGET_WINDOW_USAGE, - CMD_WINDOW_T, - cmd_select_layout_exec + .name = "previous-layout", + .alias = "prevl", + + .args = { "t:", 0, 0 }, + .usage = CMD_TARGET_WINDOW_USAGE, + + .flags = CMD_WINDOW_T, + .exec = cmd_select_layout_exec }; enum cmd_retval diff --git a/cmd-select-pane.c b/cmd-select-pane.c index e83dc609..aa12ae1e 100644 --- a/cmd-select-pane.c +++ b/cmd-select-pane.c @@ -27,19 +27,25 @@ enum cmd_retval cmd_select_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_select_pane_entry = { - "select-pane", "selectp", - "DdegLlMmP:Rt:U", 0, 0, - "[-DdegLlMmRU] [-P style] " CMD_TARGET_PANE_USAGE, - CMD_PANE_T, - cmd_select_pane_exec + .name = "select-pane", + .alias = "selectp", + + .args = { "DdegLlMmP:Rt:U", 0, 0 }, + .usage = "[-DdegLlMmRU] [-P style] " CMD_TARGET_PANE_USAGE, + + .flags = CMD_PANE_T, + .exec = cmd_select_pane_exec }; const struct cmd_entry cmd_last_pane_entry = { - "last-pane", "lastp", - "det:", 0, 0, - "[-de] " CMD_TARGET_WINDOW_USAGE, - CMD_WINDOW_T, - cmd_select_pane_exec + .name = "last-pane", + .alias = "lastp", + + .args = { "det:", 0, 0 }, + .usage = "[-de] " CMD_TARGET_WINDOW_USAGE, + + .flags = CMD_WINDOW_T, + .exec = cmd_select_pane_exec }; enum cmd_retval diff --git a/cmd-select-window.c b/cmd-select-window.c index ede60dae..9b396cf9 100644 --- a/cmd-select-window.c +++ b/cmd-select-window.c @@ -29,35 +29,47 @@ enum cmd_retval cmd_select_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_select_window_entry = { - "select-window", "selectw", - "lnpTt:", 0, 0, - "[-lnpT] " CMD_TARGET_WINDOW_USAGE, - CMD_WINDOW_T, - cmd_select_window_exec + .name = "select-window", + .alias = "selectw", + + .args = { "lnpTt:", 0, 0 }, + .usage = "[-lnpT] " CMD_TARGET_WINDOW_USAGE, + + .flags = CMD_WINDOW_T, + .exec = cmd_select_window_exec }; const struct cmd_entry cmd_next_window_entry = { - "next-window", "next", - "at:", 0, 0, - "[-a] " CMD_TARGET_SESSION_USAGE, - CMD_SESSION_T, - cmd_select_window_exec + .name = "next-window", + .alias = "next", + + .args = { "at:", 0, 0 }, + .usage = "[-a] " CMD_TARGET_SESSION_USAGE, + + .flags = CMD_SESSION_T, + .exec = cmd_select_window_exec }; const struct cmd_entry cmd_previous_window_entry = { - "previous-window", "prev", - "at:", 0, 0, - "[-a] " CMD_TARGET_SESSION_USAGE, - CMD_SESSION_T, - cmd_select_window_exec + .name = "previous-window", + .alias = "prev", + + .args = { "at:", 0, 0 }, + .usage = "[-a] " CMD_TARGET_SESSION_USAGE, + + .flags = CMD_SESSION_T, + .exec = cmd_select_window_exec }; const struct cmd_entry cmd_last_window_entry = { - "last-window", "last", - "t:", 0, 0, - CMD_TARGET_SESSION_USAGE, - CMD_SESSION_T, - cmd_select_window_exec + .name = "last-window", + .alias = "last", + + .args = { "t:", 0, 0 }, + .usage = CMD_TARGET_SESSION_USAGE, + + .flags = CMD_SESSION_T, + .exec = cmd_select_window_exec }; enum cmd_retval diff --git a/cmd-send-keys.c b/cmd-send-keys.c index 8f9b4ddf..aa78abca 100644 --- a/cmd-send-keys.c +++ b/cmd-send-keys.c @@ -30,19 +30,25 @@ enum cmd_retval cmd_send_keys_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_send_keys_entry = { - "send-keys", "send", - "lRMt:", 0, -1, - "[-lRM] " CMD_TARGET_PANE_USAGE " key ...", - CMD_PANE_T, - cmd_send_keys_exec + .name = "send-keys", + .alias = "send", + + .args = { "lRMt:", 0, -1 }, + .usage = "[-lRM] " CMD_TARGET_PANE_USAGE " key ...", + + .flags = CMD_PANE_T, + .exec = cmd_send_keys_exec }; const struct cmd_entry cmd_send_prefix_entry = { - "send-prefix", NULL, - "2t:", 0, 0, - "[-2] " CMD_TARGET_PANE_USAGE, - CMD_PANE_T, - cmd_send_keys_exec + .name = "send-prefix", + .alias = NULL, + + .args = { "2t:", 0, 0 }, + .usage = "[-2] " CMD_TARGET_PANE_USAGE, + + .flags = CMD_PANE_T, + .exec = cmd_send_keys_exec }; enum cmd_retval diff --git a/cmd-set-buffer.c b/cmd-set-buffer.c index e7f7627e..1494cf26 100644 --- a/cmd-set-buffer.c +++ b/cmd-set-buffer.c @@ -30,19 +30,25 @@ enum cmd_retval cmd_set_buffer_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_set_buffer_entry = { - "set-buffer", "setb", - "ab:n:", 0, 1, - "[-a] " CMD_BUFFER_USAGE " [-n new-buffer-name] data", - 0, - cmd_set_buffer_exec + .name = "set-buffer", + .alias = "setb", + + .args = { "ab:n:", 0, 1 }, + .usage = "[-a] " CMD_BUFFER_USAGE " [-n new-buffer-name] data", + + .flags = 0, + .exec = cmd_set_buffer_exec }; const struct cmd_entry cmd_delete_buffer_entry = { - "delete-buffer", "deleteb", - "b:", 0, 0, - CMD_BUFFER_USAGE, - 0, - cmd_set_buffer_exec + .name = "delete-buffer", + .alias = "deleteb", + + .args = { "b:", 0, 0 }, + .usage = CMD_BUFFER_USAGE, + + .flags = 0, + .exec = cmd_set_buffer_exec }; enum cmd_retval diff --git a/cmd-set-environment.c b/cmd-set-environment.c index 4be967b7..61ab0470 100644 --- a/cmd-set-environment.c +++ b/cmd-set-environment.c @@ -30,11 +30,14 @@ enum cmd_retval cmd_set_environment_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_set_environment_entry = { - "set-environment", "setenv", - "grt:u", 1, 2, - "[-gru] " CMD_TARGET_SESSION_USAGE " name [value]", - CMD_SESSION_T, - cmd_set_environment_exec + .name = "set-environment", + .alias = "setenv", + + .args = { "grt:u", 1, 2 }, + .usage = "[-gru] " CMD_TARGET_SESSION_USAGE " name [value]", + + .flags = CMD_SESSION_T, + .exec = cmd_set_environment_exec }; enum cmd_retval diff --git a/cmd-set-hook.c b/cmd-set-hook.c index d75b0ba1..e502fa79 100644 --- a/cmd-set-hook.c +++ b/cmd-set-hook.c @@ -30,19 +30,25 @@ enum cmd_retval cmd_set_hook_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_set_hook_entry = { - "set-hook", NULL, - "gt:u", 1, 2, - "[-gu] " CMD_TARGET_SESSION_USAGE " hook-name [command]", - CMD_SESSION_T, - cmd_set_hook_exec + .name = "set-hook", + .alias = NULL, + + .args = { "gt:u", 1, 2 }, + .usage = "[-gu] " CMD_TARGET_SESSION_USAGE " hook-name [command]", + + .flags = CMD_SESSION_T, + .exec = cmd_set_hook_exec }; const struct cmd_entry cmd_show_hooks_entry = { - "show-hooks", NULL, - "gt:", 0, 1, - "[-g] " CMD_TARGET_SESSION_USAGE, - CMD_SESSION_T, - cmd_set_hook_exec + .name = "show-hooks", + .alias = NULL, + + .args = { "gt:", 0, 1 }, + .usage = "[-g] " CMD_TARGET_SESSION_USAGE, + + .flags = CMD_SESSION_T, + .exec = cmd_set_hook_exec }; enum cmd_retval diff --git a/cmd-set-option.c b/cmd-set-option.c index 86856fbb..5190e181 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -65,19 +65,25 @@ struct options_entry *cmd_set_option_style(struct cmd *, struct cmd_q *, const char *); const struct cmd_entry cmd_set_option_entry = { - "set-option", "set", - "agoqst:uw", 1, 2, - "[-agosquw] [-t target-window] option [value]", - CMD_WINDOW_T|CMD_CANFAIL, - cmd_set_option_exec + .name = "set-option", + .alias = "set", + + .args = { "agoqst:uw", 1, 2 }, + .usage = "[-agosquw] [-t target-window] option [value]", + + .flags = CMD_WINDOW_T|CMD_CANFAIL, + .exec = cmd_set_option_exec }; const struct cmd_entry cmd_set_window_option_entry = { - "set-window-option", "setw", - "agoqt:u", 1, 2, - "[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]", - CMD_WINDOW_T|CMD_CANFAIL, - cmd_set_option_exec + .name = "set-window-option", + .alias = "setw", + + .args = { "agoqt:u", 1, 2 }, + .usage = "[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]", + + .flags = CMD_WINDOW_T|CMD_CANFAIL, + .exec = cmd_set_option_exec }; enum cmd_retval diff --git a/cmd-show-environment.c b/cmd-show-environment.c index 723d3039..398a1e50 100644 --- a/cmd-show-environment.c +++ b/cmd-show-environment.c @@ -34,11 +34,14 @@ void cmd_show_environment_print(struct cmd *, struct cmd_q *, struct environ_entry *); const struct cmd_entry cmd_show_environment_entry = { - "show-environment", "showenv", - "gst:", 0, 1, - "[-gs] " CMD_TARGET_SESSION_USAGE " [name]", - CMD_SESSION_T|CMD_CANFAIL, - cmd_show_environment_exec + .name = "show-environment", + .alias = "showenv", + + .args = { "gst:", 0, 1 }, + .usage = "[-gs] " CMD_TARGET_SESSION_USAGE " [name]", + + .flags = CMD_SESSION_T|CMD_CANFAIL, + .exec = cmd_show_environment_exec }; char * diff --git a/cmd-show-messages.c b/cmd-show-messages.c index b80b9fe7..e810abdc 100644 --- a/cmd-show-messages.c +++ b/cmd-show-messages.c @@ -32,19 +32,25 @@ enum cmd_retval cmd_show_messages_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_show_messages_entry = { - "show-messages", "showmsgs", - "JTt:", 0, 0, - "[-JT] " CMD_TARGET_CLIENT_USAGE, - CMD_CLIENT_T, - cmd_show_messages_exec + .name = "show-messages", + .alias = "showmsgs", + + .args = { "JTt:", 0, 0 }, + .usage = "[-JT] " CMD_TARGET_CLIENT_USAGE, + + .flags = CMD_CLIENT_T, + .exec = cmd_show_messages_exec }; const struct cmd_entry cmd_server_info_entry = { - "server-info", "info", - "", 0, 0, - "", - 0, - cmd_show_messages_exec + .name = "server-info", + .alias = "info", + + .args = { "", 0, 0 }, + .usage = "", + + .flags = 0, + .exec = cmd_show_messages_exec }; int cmd_show_messages_terminals(struct cmd_q *, int); diff --git a/cmd-show-options.c b/cmd-show-options.c index 3b39a532..4ef07e8f 100644 --- a/cmd-show-options.c +++ b/cmd-show-options.c @@ -35,19 +35,25 @@ enum cmd_retval cmd_show_options_all(struct cmd *, struct cmd_q *, struct options *, enum options_table_scope); const struct cmd_entry cmd_show_options_entry = { - "show-options", "show", - "gqst:vw", 0, 1, - "[-gqsvw] [-t target-session|target-window] [option]", - CMD_WINDOW_T|CMD_CANFAIL, - cmd_show_options_exec + .name = "show-options", + .alias = "show", + + .args = { "gqst:vw", 0, 1 }, + .usage = "[-gqsvw] [-t target-session|target-window] [option]", + + .flags = CMD_WINDOW_T|CMD_CANFAIL, + .exec = cmd_show_options_exec }; const struct cmd_entry cmd_show_window_options_entry = { - "show-window-options", "showw", - "gvt:", 0, 1, - "[-gv] " CMD_TARGET_WINDOW_USAGE " [option]", - CMD_WINDOW_T|CMD_CANFAIL, - cmd_show_options_exec + .name = "show-window-options", + .alias = "showw", + + .args = { "gvt:", 0, 1 }, + .usage = "[-gv] " CMD_TARGET_WINDOW_USAGE " [option]", + + .flags = CMD_WINDOW_T|CMD_CANFAIL, + .exec = cmd_show_options_exec }; enum cmd_retval diff --git a/cmd-source-file.c b/cmd-source-file.c index e776712c..9d2d6d68 100644 --- a/cmd-source-file.c +++ b/cmd-source-file.c @@ -31,11 +31,14 @@ enum cmd_retval cmd_source_file_exec(struct cmd *, struct cmd_q *); void cmd_source_file_done(struct cmd_q *); const struct cmd_entry cmd_source_file_entry = { - "source-file", "source", - "", 1, 1, - "path", - 0, - cmd_source_file_exec + .name = "source-file", + .alias = "source", + + .args = { "", 1, 1 }, + .usage = "path", + + .flags = 0, + .exec = cmd_source_file_exec }; enum cmd_retval diff --git a/cmd-split-window.c b/cmd-split-window.c index 59efae35..cb776d63 100644 --- a/cmd-split-window.c +++ b/cmd-split-window.c @@ -36,12 +36,15 @@ enum cmd_retval cmd_split_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_split_window_entry = { - "split-window", "splitw", - "bc:dF:l:hp:Pt:v", 0, -1, - "[-bdhvP] [-c start-directory] [-F format] [-p percentage|-l size] " - CMD_TARGET_PANE_USAGE " [command]", - CMD_PANE_T, - cmd_split_window_exec + .name = "split-window", + .alias = "splitw", + + .args = { "bc:dF:l:hp:Pt:v", 0, -1 }, + .usage = "[-bdhvP] [-c start-directory] [-F format] " + "[-p percentage|-l size] " CMD_TARGET_PANE_USAGE " [command]", + + .flags = CMD_PANE_T, + .exec = cmd_split_window_exec }; enum cmd_retval diff --git a/cmd-swap-pane.c b/cmd-swap-pane.c index 62d6bad3..7b50e3be 100644 --- a/cmd-swap-pane.c +++ b/cmd-swap-pane.c @@ -29,11 +29,14 @@ enum cmd_retval cmd_swap_pane_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_swap_pane_entry = { - "swap-pane", "swapp", - "dDs:t:U", 0, 0, - "[-dDU] " CMD_SRCDST_PANE_USAGE, - CMD_PANE_MARKED_S|CMD_PANE_T, - cmd_swap_pane_exec + .name = "swap-pane", + .alias = "swapp", + + .args = { "dDs:t:U", 0, 0 }, + .usage = "[-dDU] " CMD_SRCDST_PANE_USAGE, + + .flags = CMD_PANE_MARKED_S|CMD_PANE_T, + .exec = cmd_swap_pane_exec }; enum cmd_retval diff --git a/cmd-swap-window.c b/cmd-swap-window.c index 0ed3ca81..38a3bf78 100644 --- a/cmd-swap-window.c +++ b/cmd-swap-window.c @@ -29,11 +29,14 @@ enum cmd_retval cmd_swap_window_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_swap_window_entry = { - "swap-window", "swapw", - "ds:t:", 0, 0, - "[-d] " CMD_SRCDST_WINDOW_USAGE, - CMD_WINDOW_MARKED_S|CMD_WINDOW_MARKED_T, - cmd_swap_window_exec + .name = "swap-window", + .alias = "swapw", + + .args = { "ds:t:", 0, 0 }, + .usage = "[-d] " CMD_SRCDST_WINDOW_USAGE, + + .flags = CMD_WINDOW_MARKED_S|CMD_WINDOW_MARKED_T, + .exec = cmd_swap_window_exec }; enum cmd_retval diff --git a/cmd-switch-client.c b/cmd-switch-client.c index 919d0057..5a1fe33d 100644 --- a/cmd-switch-client.c +++ b/cmd-switch-client.c @@ -30,11 +30,16 @@ enum cmd_retval cmd_switch_client_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_switch_client_entry = { - "switch-client", "switchc", - "lc:Enpt:rT:", 0, 0, - "[-Elnpr] [-c target-client] [-t target-session] [-T key-table]", - CMD_READONLY|CMD_CLIENT_C|CMD_PANE_T|CMD_SESSION_T|CMD_PREFERUNATTACHED, - cmd_switch_client_exec + .name = "switch-client", + .alias = "switchc", + + .args = { "lc:Enpt:rT:", 0, 0 }, + .usage = "[-Elnpr] [-c target-client] [-t target-session] " + "[-T key-table]", + + .flags = CMD_READONLY|CMD_CLIENT_C|CMD_PANE_T|CMD_SESSION_T| + CMD_PREFERUNATTACHED, + .exec = cmd_switch_client_exec }; enum cmd_retval @@ -48,7 +53,6 @@ cmd_switch_client_exec(struct cmd *self, struct cmd_q *cmdq) const char *tablename, *update; struct key_table *table; - if (args_has(args, 'r')) c->flags ^= CLIENT_READONLY; diff --git a/cmd-unbind-key.c b/cmd-unbind-key.c index 66a4525e..8e89f21a 100644 --- a/cmd-unbind-key.c +++ b/cmd-unbind-key.c @@ -31,11 +31,14 @@ enum cmd_retval cmd_unbind_key_mode_table(struct cmd *, struct cmd_q *, key_code); const struct cmd_entry cmd_unbind_key_entry = { - "unbind-key", "unbind", - "acnt:T:", 0, 1, - "[-acn] [-t mode-table] [-T key-table] key", - 0, - cmd_unbind_key_exec + .name = "unbind-key", + .alias = "unbind", + + .args = { "acnt:T:", 0, 1 }, + .usage = "[-acn] [-t mode-table] [-T key-table] key", + + .flags = 0, + .exec = cmd_unbind_key_exec }; enum cmd_retval diff --git a/cmd-wait-for.c b/cmd-wait-for.c index 04316d5e..59f7dbfb 100644 --- a/cmd-wait-for.c +++ b/cmd-wait-for.c @@ -31,11 +31,14 @@ enum cmd_retval cmd_wait_for_exec(struct cmd *, struct cmd_q *); const struct cmd_entry cmd_wait_for_entry = { - "wait-for", "wait", - "LSU", 1, 1, - "[-L|-S|-U] channel", - 0, - cmd_wait_for_exec + .name = "wait-for", + .alias = "wait", + + .args = { "LSU", 1, 1 }, + .usage = "[-L|-S|-U] channel", + + .flags = 0, + .exec = cmd_wait_for_exec }; struct wait_channel { diff --git a/cmd.c b/cmd.c index 9f05a11e..f47991a3 100644 --- a/cmd.c +++ b/cmd.c @@ -353,12 +353,12 @@ cmd_parse(int argc, char **argv, const char *file, u_int line, char **cause) return (NULL); } - args = args_parse(entry->args_template, argc, argv); + args = args_parse(entry->args.template, argc, argv); if (args == NULL) goto usage; - if (entry->args_lower != -1 && args->argc < entry->args_lower) + if (entry->args.lower != -1 && args->argc < entry->args.lower) goto usage; - if (entry->args_upper != -1 && args->argc > entry->args_upper) + if (entry->args.upper != -1 && args->argc > entry->args.upper) goto usage; cmd = xcalloc(1, sizeof *cmd); diff --git a/tmux.h b/tmux.h index 8b26431d..c9adb2ee 100644 --- a/tmux.h +++ b/tmux.h @@ -1389,14 +1389,16 @@ struct cmd_q { /* Command definition. */ struct cmd_entry { - const char *name; - const char *alias; + const char *name; + const char *alias; - const char *args_template; - int args_lower; - int args_upper; + struct { + const char *template; + int lower; + int upper; + } args; - const char *usage; + const char *usage; #define CMD_STARTSERVER 0x1 #define CMD_READONLY 0x2 @@ -1418,9 +1420,9 @@ struct cmd_entry { #define CMD_WINDOW_MARKED_T 0x20000 #define CMD_WINDOW_MARKED_S 0x40000 #define CMD_CLIENT_CANFAIL 0x80000 - int flags; + int flags; - enum cmd_retval (*exec)(struct cmd *, struct cmd_q *); + enum cmd_retval (*exec)(struct cmd *, struct cmd_q *); }; #define CMD_ALL_T (CMD_SESSION_T|CMD_WINDOW_T|CMD_PANE_T|CMD_INDEX_T| \ CMD_MOVEW_R|CMD_PANE_MARKED_T|CMD_WINDOW_MARKED_T)