diff options
author | Tiago Cunha <tcunha@gmx.com> | 2011-01-07 14:45:34 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2011-01-07 14:45:34 +0000 |
commit | 1df427bc7b1a458f4d3fe6f9255010708a8d8634 (patch) | |
tree | 6d47a72a426bb3e18146c682591d398607a8a211 /cmd-list-panes.c | |
parent | 219442cff707a1febb6a75ba2cfe48b02ae0a22e (diff) |
Sync OpenBSD patchset 829:
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.
Diffstat (limited to 'cmd-list-panes.c')
-rw-r--r-- | cmd-list-panes.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/cmd-list-panes.c b/cmd-list-panes.c index 0c1b8ada..8533b624 100644 --- a/cmd-list-panes.c +++ b/cmd-list-panes.c @@ -1,4 +1,4 @@ -/* $Id: cmd-list-panes.c,v 1.6 2010-12-06 21:56:32 nicm Exp $ */ +/* $Id: cmd-list-panes.c,v 1.7 2011-01-07 14:45:34 tcunha Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -30,19 +30,18 @@ int cmd_list_panes_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_list_panes_entry = { "list-panes", "lsp", + "t:", 0, 0, CMD_TARGET_WINDOW_USAGE, - 0, "", - cmd_target_init, - cmd_target_parse, - cmd_list_panes_exec, - cmd_target_free, - cmd_target_print + 0, + NULL, + NULL, + cmd_list_panes_exec }; int cmd_list_panes_exec(struct cmd *self, struct cmd_ctx *ctx) { - struct cmd_target_data *data = self->data; + struct args *args = self->args; struct winlink *wl; struct window_pane *wp; struct grid *gd; @@ -50,7 +49,7 @@ cmd_list_panes_exec(struct cmd *self, struct cmd_ctx *ctx) u_int i, n; unsigned long long size; - if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL) + if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL) return (-1); n = 0; |