Remove the barely-used and unnecessary command check() function.

This commit is contained in:
nicm 2013-10-10 12:00:18 +00:00
parent 90ae7682ed
commit d45c12b6c9
62 changed files with 23 additions and 105 deletions

View File

@ -27,7 +27,6 @@
* Bind a key to a command, this recurses through cmd_*. * Bind a key to a command, this recurses through cmd_*.
*/ */
enum cmd_retval cmd_bind_key_check(struct args *);
enum cmd_retval cmd_bind_key_exec(struct cmd *, struct cmd_q *); enum cmd_retval cmd_bind_key_exec(struct cmd *, struct cmd_q *);
enum cmd_retval cmd_bind_key_table(struct cmd *, struct cmd_q *, int); enum cmd_retval cmd_bind_key_table(struct cmd *, struct cmd_q *, int);
@ -38,23 +37,9 @@ const struct cmd_entry cmd_bind_key_entry = {
"[-cnr] [-t key-table] key command [arguments]", "[-cnr] [-t key-table] key command [arguments]",
0, 0,
NULL, NULL,
cmd_bind_key_check,
cmd_bind_key_exec cmd_bind_key_exec
}; };
enum cmd_retval
cmd_bind_key_check(struct args *args)
{
if (args_has(args, 't')) {
if (args->argc != 2 && args->argc != 3)
return (CMD_RETURN_ERROR);
} else {
if (args->argc < 2)
return (CMD_RETURN_ERROR);
}
return (CMD_RETURN_NORMAL);
}
enum cmd_retval enum cmd_retval
cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq) cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
@ -63,6 +48,18 @@ cmd_bind_key_exec(struct cmd *self, struct cmd_q *cmdq)
struct cmd_list *cmdlist; struct cmd_list *cmdlist;
int key; int key;
if (args_has(args, 't')) {
if (args->argc != 2 && args->argc != 3) {
cmdq_error(cmdq, "not enough arguments");
return (CMD_RETURN_ERROR);
}
} else {
if (args->argc < 2) {
cmdq_error(cmdq, "not enough arguments");
return (CMD_RETURN_ERROR);
}
}
key = key_string_lookup_string(args->argv[0]); key = key_string_lookup_string(args->argv[0]);
if (key == KEYC_NONE) { if (key == KEYC_NONE) {
cmdq_error(cmdq, "unknown key: %s", args->argv[0]); cmdq_error(cmdq, "unknown key: %s", args->argv[0]);

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_break_pane_entry = {
"[-dP] [-F format] " CMD_TARGET_PANE_USAGE, "[-dP] [-F format] " CMD_TARGET_PANE_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_break_pane_exec cmd_break_pane_exec
}; };

View File

@ -42,7 +42,6 @@ const struct cmd_entry cmd_capture_pane_entry = {
CMD_TARGET_PANE_USAGE, CMD_TARGET_PANE_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_capture_pane_exec cmd_capture_pane_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_choose_buffer_entry = {
CMD_TARGET_WINDOW_USAGE " [-F format] [template]", CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
0, 0,
NULL, NULL,
NULL,
cmd_choose_buffer_exec cmd_choose_buffer_exec
}; };

View File

@ -37,7 +37,6 @@ const struct cmd_entry cmd_choose_client_entry = {
CMD_TARGET_WINDOW_USAGE " [-F format] [template]", CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
0, 0,
NULL, NULL,
NULL,
cmd_choose_client_exec cmd_choose_client_exec
}; };

View File

@ -39,7 +39,6 @@ const struct cmd_entry cmd_choose_list_entry = {
"[-l items] " CMD_TARGET_WINDOW_USAGE "[template]", "[-l items] " CMD_TARGET_WINDOW_USAGE "[template]",
0, 0,
NULL, NULL,
NULL,
cmd_choose_list_exec cmd_choose_list_exec
}; };

View File

@ -41,7 +41,6 @@ const struct cmd_entry cmd_choose_tree_entry = {
"[-W format] " CMD_TARGET_WINDOW_USAGE, "[-W format] " CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_choose_tree_exec cmd_choose_tree_exec
}; };
@ -51,7 +50,6 @@ const struct cmd_entry cmd_choose_session_entry = {
CMD_TARGET_WINDOW_USAGE " [-F format] [template]", CMD_TARGET_WINDOW_USAGE " [-F format] [template]",
0, 0,
NULL, NULL,
NULL,
cmd_choose_tree_exec cmd_choose_tree_exec
}; };
@ -61,7 +59,6 @@ const struct cmd_entry cmd_choose_window_entry = {
CMD_TARGET_WINDOW_USAGE "[-F format] [template]", CMD_TARGET_WINDOW_USAGE "[-F format] [template]",
0, 0,
NULL, NULL,
NULL,
cmd_choose_tree_exec cmd_choose_tree_exec
}; };
@ -228,7 +225,6 @@ windows_only:
free(final_win_template_last); free(final_win_template_last);
window_choose_ready(wl->window->active, cur_win, NULL); window_choose_ready(wl->window->active, cur_win, NULL);
window_choose_collapse_all(wl->window->active);
if (args_has(args, 'u')) { if (args_has(args, 'u')) {
window_choose_expand_all(wl->window->active); window_choose_expand_all(wl->window->active);

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_clear_history_entry = {
CMD_TARGET_PANE_USAGE, CMD_TARGET_PANE_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_clear_history_exec cmd_clear_history_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_clock_mode_entry = {
CMD_TARGET_PANE_USAGE, CMD_TARGET_PANE_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_clock_mode_exec cmd_clock_mode_exec
}; };

View File

@ -30,7 +30,6 @@
*/ */
void cmd_command_prompt_key_binding(struct cmd *, int); void cmd_command_prompt_key_binding(struct cmd *, int);
int cmd_command_prompt_check(struct args *);
enum cmd_retval cmd_command_prompt_exec(struct cmd *, struct cmd_q *); enum cmd_retval cmd_command_prompt_exec(struct cmd *, struct cmd_q *);
int cmd_command_prompt_callback(void *, const char *); int cmd_command_prompt_callback(void *, const char *);
@ -42,7 +41,6 @@ const struct cmd_entry cmd_command_prompt_entry = {
"[-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " [template]", "[-I inputs] [-p prompts] " CMD_TARGET_CLIENT_USAGE " [template]",
0, 0,
cmd_command_prompt_key_binding, cmd_command_prompt_key_binding,
NULL,
cmd_command_prompt_exec cmd_command_prompt_exec
}; };

View File

@ -38,7 +38,6 @@ const struct cmd_entry cmd_confirm_before_entry = {
"[-p prompt] " CMD_TARGET_CLIENT_USAGE " command", "[-p prompt] " CMD_TARGET_CLIENT_USAGE " command",
0, 0,
cmd_confirm_before_key_binding, cmd_confirm_before_key_binding,
NULL,
cmd_confirm_before_exec cmd_confirm_before_exec
}; };

View File

@ -33,7 +33,6 @@ const struct cmd_entry cmd_copy_mode_entry = {
"[-u] " CMD_TARGET_PANE_USAGE, "[-u] " CMD_TARGET_PANE_USAGE,
0, 0,
cmd_copy_mode_key_binding, cmd_copy_mode_key_binding,
NULL,
cmd_copy_mode_exec cmd_copy_mode_exec
}; };

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_delete_buffer_entry = {
CMD_BUFFER_USAGE, CMD_BUFFER_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_delete_buffer_exec cmd_delete_buffer_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_detach_client_entry = {
"[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE, "[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE,
CMD_READONLY, CMD_READONLY,
NULL, NULL,
NULL,
cmd_detach_client_exec cmd_detach_client_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_display_panes_entry = {
CMD_TARGET_CLIENT_USAGE, CMD_TARGET_CLIENT_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_display_panes_exec cmd_display_panes_exec
}; };

View File

@ -48,7 +48,6 @@ const struct cmd_entry cmd_find_window_entry = {
"[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string", "[-CNT] [-F format] " CMD_TARGET_WINDOW_USAGE " match-string",
0, 0,
NULL, NULL,
NULL,
cmd_find_window_exec cmd_find_window_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_has_session_entry = {
CMD_TARGET_SESSION_USAGE, CMD_TARGET_SESSION_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_has_session_exec cmd_has_session_exec
}; };

View File

@ -40,7 +40,6 @@ const struct cmd_entry cmd_join_pane_entry = {
"[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]", "[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]",
0, 0,
cmd_join_pane_key_binding, cmd_join_pane_key_binding,
NULL,
cmd_join_pane_exec cmd_join_pane_exec
}; };
@ -50,7 +49,6 @@ const struct cmd_entry cmd_move_pane_entry = {
"[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]", "[-bdhv] [-p percentage|-l size] [-s src-pane] [-t dst-pane]",
0, 0,
NULL, NULL,
NULL,
cmd_join_pane_exec cmd_join_pane_exec
}; };

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_kill_pane_entry = {
"[-a] " CMD_TARGET_PANE_USAGE, "[-a] " CMD_TARGET_PANE_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_kill_pane_exec cmd_kill_pane_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_kill_server_entry = {
"", "",
0, 0,
NULL, NULL,
NULL,
cmd_kill_server_exec cmd_kill_server_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_kill_session_entry = {
"[-a] " CMD_TARGET_SESSION_USAGE, "[-a] " CMD_TARGET_SESSION_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_kill_session_exec cmd_kill_session_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_kill_window_entry = {
"[-a] " CMD_TARGET_WINDOW_USAGE, "[-a] " CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_kill_window_exec cmd_kill_window_exec
}; };

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_link_window_entry = {
"[-dk] " CMD_SRCDST_WINDOW_USAGE, "[-dk] " CMD_SRCDST_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_link_window_exec cmd_link_window_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_list_buffers_entry = {
"[-F format]", "[-F format]",
0, 0,
NULL, NULL,
NULL,
cmd_list_buffers_exec cmd_list_buffers_exec
}; };

View File

@ -36,7 +36,6 @@ const struct cmd_entry cmd_list_clients_entry = {
"[-F format] " CMD_TARGET_SESSION_USAGE, "[-F format] " CMD_TARGET_SESSION_USAGE,
CMD_READONLY, CMD_READONLY,
NULL, NULL,
NULL,
cmd_list_clients_exec cmd_list_clients_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_list_commands_entry = {
"", "",
0, 0,
NULL, NULL,
NULL,
cmd_list_commands_exec cmd_list_commands_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_list_keys_entry = {
"[-t key-table]", "[-t key-table]",
0, 0,
NULL, NULL,
NULL,
cmd_list_keys_exec cmd_list_keys_exec
}; };

View File

@ -41,7 +41,6 @@ const struct cmd_entry cmd_list_panes_entry = {
"[-as] [-F format] " CMD_TARGET_WINDOW_USAGE, "[-as] [-F format] " CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_list_panes_exec cmd_list_panes_exec
}; };

View File

@ -36,7 +36,6 @@ const struct cmd_entry cmd_list_sessions_entry = {
"[-F format]", "[-F format]",
0, 0,
NULL, NULL,
NULL,
cmd_list_sessions_exec cmd_list_sessions_exec
}; };

View File

@ -39,7 +39,6 @@ const struct cmd_entry cmd_list_windows_entry = {
"[-a] [-F format] " CMD_TARGET_SESSION_USAGE, "[-a] [-F format] " CMD_TARGET_SESSION_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_list_windows_exec cmd_list_windows_exec
}; };

View File

@ -39,7 +39,6 @@ const struct cmd_entry cmd_load_buffer_entry = {
CMD_BUFFER_USAGE " path", CMD_BUFFER_USAGE " path",
0, 0,
NULL, NULL,
NULL,
cmd_load_buffer_exec cmd_load_buffer_exec
}; };

View File

@ -36,7 +36,6 @@ const struct cmd_entry cmd_lock_server_entry = {
"", "",
0, 0,
NULL, NULL,
NULL,
cmd_lock_server_exec cmd_lock_server_exec
}; };
@ -46,7 +45,6 @@ const struct cmd_entry cmd_lock_session_entry = {
CMD_TARGET_SESSION_USAGE, CMD_TARGET_SESSION_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_lock_server_exec cmd_lock_server_exec
}; };
@ -56,7 +54,6 @@ const struct cmd_entry cmd_lock_client_entry = {
CMD_TARGET_CLIENT_USAGE, CMD_TARGET_CLIENT_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_lock_server_exec cmd_lock_server_exec
}; };

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_move_window_entry = {
"[-dkr] " CMD_SRCDST_WINDOW_USAGE, "[-dkr] " CMD_SRCDST_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_move_window_exec cmd_move_window_exec
}; };

View File

@ -39,7 +39,6 @@ const struct cmd_entry cmd_paste_buffer_entry = {
"[-dpr] [-s separator] [-b buffer-index] " CMD_TARGET_PANE_USAGE, "[-dpr] [-s separator] [-b buffer-index] " CMD_TARGET_PANE_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_paste_buffer_exec cmd_paste_buffer_exec
}; };

View File

@ -42,7 +42,6 @@ const struct cmd_entry cmd_pipe_pane_entry = {
"[-o] " CMD_TARGET_PANE_USAGE " [command]", "[-o] " CMD_TARGET_PANE_USAGE " [command]",
0, 0,
NULL, NULL,
NULL,
cmd_pipe_pane_exec cmd_pipe_pane_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_refresh_client_entry = {
"[-S] [-C size] " CMD_TARGET_CLIENT_USAGE, "[-S] [-C size] " CMD_TARGET_CLIENT_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_refresh_client_exec cmd_refresh_client_exec
}; };

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_rename_session_entry = {
CMD_TARGET_SESSION_USAGE " new-name", CMD_TARGET_SESSION_USAGE " new-name",
0, 0,
NULL, NULL,
NULL,
cmd_rename_session_exec cmd_rename_session_exec
}; };

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_rename_window_entry = {
CMD_TARGET_WINDOW_USAGE " new-name", CMD_TARGET_WINDOW_USAGE " new-name",
0, 0,
NULL, NULL,
NULL,
cmd_rename_window_exec cmd_rename_window_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_resize_pane_entry = {
"[-DLRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " [adjustment]", "[-DLRUZ] [-x width] [-y height] " CMD_TARGET_PANE_USAGE " [adjustment]",
0, 0,
cmd_resize_pane_key_binding, cmd_resize_pane_key_binding,
NULL,
cmd_resize_pane_exec cmd_resize_pane_exec
}; };

View File

@ -36,7 +36,6 @@ const struct cmd_entry cmd_respawn_pane_entry = {
"[-k] " CMD_TARGET_PANE_USAGE " [command]", "[-k] " CMD_TARGET_PANE_USAGE " [command]",
0, 0,
NULL, NULL,
NULL,
cmd_respawn_pane_exec cmd_respawn_pane_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_respawn_window_entry = {
"[-k] " CMD_TARGET_WINDOW_USAGE " [command]", "[-k] " CMD_TARGET_WINDOW_USAGE " [command]",
0, 0,
NULL, NULL,
NULL,
cmd_respawn_window_exec cmd_respawn_window_exec
}; };

View File

@ -33,7 +33,6 @@ const struct cmd_entry cmd_rotate_window_entry = {
"[-DU] " CMD_TARGET_WINDOW_USAGE, "[-DU] " CMD_TARGET_WINDOW_USAGE,
0, 0,
cmd_rotate_window_key_binding, cmd_rotate_window_key_binding,
NULL,
cmd_rotate_window_exec cmd_rotate_window_exec
}; };

View File

@ -41,7 +41,6 @@ const struct cmd_entry cmd_run_shell_entry = {
"[-b] " CMD_TARGET_PANE_USAGE " shell-command", "[-b] " CMD_TARGET_PANE_USAGE " shell-command",
0, 0,
NULL, NULL,
NULL,
cmd_run_shell_exec cmd_run_shell_exec
}; };

View File

@ -38,7 +38,6 @@ const struct cmd_entry cmd_save_buffer_entry = {
"[-a] " CMD_BUFFER_USAGE " path", "[-a] " CMD_BUFFER_USAGE " path",
0, 0,
NULL, NULL,
NULL,
cmd_save_buffer_exec cmd_save_buffer_exec
}; };
@ -48,7 +47,6 @@ const struct cmd_entry cmd_show_buffer_entry = {
CMD_BUFFER_USAGE, CMD_BUFFER_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_save_buffer_exec cmd_save_buffer_exec
}; };

View File

@ -33,7 +33,6 @@ const struct cmd_entry cmd_select_layout_entry = {
"[-np] " CMD_TARGET_WINDOW_USAGE " [layout-name]", "[-np] " CMD_TARGET_WINDOW_USAGE " [layout-name]",
0, 0,
cmd_select_layout_key_binding, cmd_select_layout_key_binding,
NULL,
cmd_select_layout_exec cmd_select_layout_exec
}; };
@ -43,7 +42,6 @@ const struct cmd_entry cmd_next_layout_entry = {
CMD_TARGET_WINDOW_USAGE, CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_select_layout_exec cmd_select_layout_exec
}; };
@ -53,7 +51,6 @@ const struct cmd_entry cmd_previous_layout_entry = {
CMD_TARGET_WINDOW_USAGE, CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_select_layout_exec cmd_select_layout_exec
}; };

View File

@ -33,7 +33,6 @@ const struct cmd_entry cmd_select_pane_entry = {
"[-lDLRU] " CMD_TARGET_PANE_USAGE, "[-lDLRU] " CMD_TARGET_PANE_USAGE,
0, 0,
cmd_select_pane_key_binding, cmd_select_pane_key_binding,
NULL,
cmd_select_pane_exec cmd_select_pane_exec
}; };
@ -43,7 +42,6 @@ const struct cmd_entry cmd_last_pane_entry = {
CMD_TARGET_WINDOW_USAGE, CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_select_pane_exec cmd_select_pane_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_select_window_entry = {
"[-lnpT] " CMD_TARGET_WINDOW_USAGE, "[-lnpT] " CMD_TARGET_WINDOW_USAGE,
0, 0,
cmd_select_window_key_binding, cmd_select_window_key_binding,
NULL,
cmd_select_window_exec cmd_select_window_exec
}; };
@ -45,7 +44,6 @@ const struct cmd_entry cmd_next_window_entry = {
"[-a] " CMD_TARGET_SESSION_USAGE, "[-a] " CMD_TARGET_SESSION_USAGE,
0, 0,
cmd_select_window_key_binding, cmd_select_window_key_binding,
NULL,
cmd_select_window_exec cmd_select_window_exec
}; };
@ -55,7 +53,6 @@ const struct cmd_entry cmd_previous_window_entry = {
"[-a] " CMD_TARGET_SESSION_USAGE, "[-a] " CMD_TARGET_SESSION_USAGE,
0, 0,
cmd_select_window_key_binding, cmd_select_window_key_binding,
NULL,
cmd_select_window_exec cmd_select_window_exec
}; };
@ -65,7 +62,6 @@ const struct cmd_entry cmd_last_window_entry = {
CMD_TARGET_SESSION_USAGE, CMD_TARGET_SESSION_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_select_window_exec cmd_select_window_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_send_keys_entry = {
"[-lR] " CMD_TARGET_PANE_USAGE " key ...", "[-lR] " CMD_TARGET_PANE_USAGE " key ...",
0, 0,
NULL, NULL,
NULL,
cmd_send_keys_exec cmd_send_keys_exec
}; };
@ -45,7 +44,6 @@ const struct cmd_entry cmd_send_prefix_entry = {
"[-2] " CMD_TARGET_PANE_USAGE, "[-2] " CMD_TARGET_PANE_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_send_keys_exec cmd_send_keys_exec
}; };

View File

@ -39,7 +39,6 @@ const struct cmd_entry cmd_server_info_entry = {
"", "",
0, 0,
NULL, NULL,
NULL,
cmd_server_info_exec cmd_server_info_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_set_buffer_entry = {
CMD_BUFFER_USAGE " data", CMD_BUFFER_USAGE " data",
0, 0,
NULL, NULL,
NULL,
cmd_set_buffer_exec cmd_set_buffer_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_set_environment_entry = {
"[-gru] " CMD_TARGET_SESSION_USAGE " name [value]", "[-gru] " CMD_TARGET_SESSION_USAGE " name [value]",
0, 0,
NULL, NULL,
NULL,
cmd_set_environment_exec cmd_set_environment_exec
}; };

View File

@ -67,7 +67,6 @@ const struct cmd_entry cmd_set_option_entry = {
"[-agosquw] [-t target-session|target-window] option [value]", "[-agosquw] [-t target-session|target-window] option [value]",
0, 0,
NULL, NULL,
NULL,
cmd_set_option_exec cmd_set_option_exec
}; };
@ -77,7 +76,6 @@ const struct cmd_entry cmd_set_window_option_entry = {
"[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]", "[-agoqu] " CMD_TARGET_WINDOW_USAGE " option [value]",
0, 0,
NULL, NULL,
NULL,
cmd_set_option_exec cmd_set_option_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_show_environment_entry = {
"[-g] " CMD_TARGET_SESSION_USAGE " [name]", "[-g] " CMD_TARGET_SESSION_USAGE " [name]",
0, 0,
NULL, NULL,
NULL,
cmd_show_environment_exec cmd_show_environment_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_show_messages_entry = {
CMD_TARGET_CLIENT_USAGE, CMD_TARGET_CLIENT_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_show_messages_exec cmd_show_messages_exec
}; };

View File

@ -40,7 +40,6 @@ const struct cmd_entry cmd_show_options_entry = {
"[-gqsvw] [-t target-session|target-window] [option]", "[-gqsvw] [-t target-session|target-window] [option]",
0, 0,
NULL, NULL,
NULL,
cmd_show_options_exec cmd_show_options_exec
}; };
@ -50,7 +49,6 @@ const struct cmd_entry cmd_show_window_options_entry = {
"[-gv] " CMD_TARGET_WINDOW_USAGE " [option]", "[-gv] " CMD_TARGET_WINDOW_USAGE " [option]",
0, 0,
NULL, NULL,
NULL,
cmd_show_options_exec cmd_show_options_exec
}; };

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_start_server_entry = {
"", "",
CMD_STARTSERVER, CMD_STARTSERVER,
NULL, NULL,
NULL,
cmd_start_server_exec cmd_start_server_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_suspend_client_entry = {
CMD_TARGET_CLIENT_USAGE, CMD_TARGET_CLIENT_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_suspend_client_exec cmd_suspend_client_exec
}; };

View File

@ -35,7 +35,6 @@ const struct cmd_entry cmd_swap_pane_entry = {
"[-dDU] " CMD_SRCDST_PANE_USAGE, "[-dDU] " CMD_SRCDST_PANE_USAGE,
0, 0,
cmd_swap_pane_key_binding, cmd_swap_pane_key_binding,
NULL,
cmd_swap_pane_exec cmd_swap_pane_exec
}; };

View File

@ -34,7 +34,6 @@ const struct cmd_entry cmd_swap_window_entry = {
"[-d] " CMD_SRCDST_WINDOW_USAGE, "[-d] " CMD_SRCDST_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_swap_window_exec cmd_swap_window_exec
}; };

View File

@ -36,7 +36,6 @@ const struct cmd_entry cmd_switch_client_entry = {
"[-lnpr] [-c target-client] [-t target-session]", "[-lnpr] [-c target-client] [-t target-session]",
CMD_READONLY, CMD_READONLY,
cmd_switch_client_key_binding, cmd_switch_client_key_binding,
NULL,
cmd_switch_client_exec cmd_switch_client_exec
}; };

View File

@ -26,7 +26,6 @@
* Unbind key from command. * Unbind key from command.
*/ */
enum cmd_retval cmd_unbind_key_check(struct args *);
enum cmd_retval cmd_unbind_key_exec(struct cmd *, struct cmd_q *); enum cmd_retval cmd_unbind_key_exec(struct cmd *, struct cmd_q *);
enum cmd_retval cmd_unbind_key_table(struct cmd *, struct cmd_q *, int); enum cmd_retval cmd_unbind_key_table(struct cmd *, struct cmd_q *, int);
@ -36,20 +35,9 @@ const struct cmd_entry cmd_unbind_key_entry = {
"[-acn] [-t key-table] key", "[-acn] [-t key-table] key",
0, 0,
NULL, NULL,
cmd_unbind_key_check,
cmd_unbind_key_exec cmd_unbind_key_exec
}; };
enum cmd_retval
cmd_unbind_key_check(struct args *args)
{
if (args_has(args, 'a') && args->argc != 0)
return (CMD_RETURN_ERROR);
if (!args_has(args, 'a') && args->argc != 1)
return (CMD_RETURN_ERROR);
return (CMD_RETURN_NORMAL);
}
enum cmd_retval enum cmd_retval
cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq) cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
@ -58,13 +46,23 @@ cmd_unbind_key_exec(struct cmd *self, struct cmd_q *cmdq)
int key; int key;
if (!args_has(args, 'a')) { if (!args_has(args, 'a')) {
if (args->argc != 1) {
cmdq_error(cmdq, "missing key");
return (CMD_RETURN_ERROR);
}
return (CMD_RETURN_ERROR);
key = key_string_lookup_string(args->argv[0]); key = key_string_lookup_string(args->argv[0]);
if (key == KEYC_NONE) { if (key == KEYC_NONE) {
cmdq_error(cmdq, "unknown key: %s", args->argv[0]); cmdq_error(cmdq, "unknown key: %s", args->argv[0]);
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
} }
} else } else {
if (args->argc != 0) {
cmdq_error(cmdq, "key given with -a");
return (CMD_RETURN_ERROR);
}
key = KEYC_NONE; key = KEYC_NONE;
}
if (args_has(args, 't')) if (args_has(args, 't'))
return (cmd_unbind_key_table(self, cmdq, key)); return (cmd_unbind_key_table(self, cmdq, key));

View File

@ -32,7 +32,6 @@ const struct cmd_entry cmd_unlink_window_entry = {
"[-k] " CMD_TARGET_WINDOW_USAGE, "[-k] " CMD_TARGET_WINDOW_USAGE,
0, 0,
NULL, NULL,
NULL,
cmd_unlink_window_exec cmd_unlink_window_exec
}; };