From 7502cb3adbb26a2f94445a35626e64041d6769f9 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Tue, 4 Jan 2011 00:42:46 +0000 Subject: Clean up and simplify tmux command argument parsing. Originally, tmux commands were parsed in the client process into a struct with the command data which was then serialised and sent to the server to be executed. The parsing was later moved into the server (an argv was sent from the client), but the parse step and intermediate struct was kept. This change removes that struct and the separate parse step. Argument parsing and printing is now common to all commands (in arguments.c) with each command left with just an optional check function (to validate the arguments at parse time), the exec function and a function to set up any key bindings (renamed from the old init function). This is overall more simple and consistent. There should be no changes to any commands behaviour or syntax although as this touches every command please watch for any unexpected changes. --- cmd-display-panes.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'cmd-display-panes.c') diff --git a/cmd-display-panes.c b/cmd-display-panes.c index 42ecbb9b..bc64b4b5 100644 --- a/cmd-display-panes.c +++ b/cmd-display-panes.c @@ -28,22 +28,21 @@ int cmd_display_panes_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_display_panes_entry = { "display-panes", "displayp", + "t:", 0, 0, CMD_TARGET_CLIENT_USAGE, - 0, "", - cmd_target_init, - cmd_target_parse, - cmd_display_panes_exec, - cmd_target_free, - cmd_target_print + 0, + NULL, + NULL, + cmd_display_panes_exec }; int cmd_display_panes_exec(struct cmd *self, struct cmd_ctx *ctx) { - struct cmd_target_data *data = self->data; - struct client *c; + struct args *args = self->args; + struct client *c; - if ((c = cmd_find_client(ctx, data->target)) == NULL) + if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL) return (-1); server_set_identify(c); -- cgit v1.2.3