summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-choose-session.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tmux/cmd-choose-session.c')
-rw-r--r--usr.bin/tmux/cmd-choose-session.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/usr.bin/tmux/cmd-choose-session.c b/usr.bin/tmux/cmd-choose-session.c
index 3b1a70fc1cc..ff386e0fe11 100644
--- a/usr.bin/tmux/cmd-choose-session.c
+++ b/usr.bin/tmux/cmd-choose-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-choose-session.c,v 1.11 2010/12/21 22:37:59 nicm Exp $ */
+/* $OpenBSD: cmd-choose-session.c,v 1.12 2011/01/04 00:42:46 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -33,13 +33,12 @@ void cmd_choose_session_free(void *);
const struct cmd_entry cmd_choose_session_entry = {
"choose-session", NULL,
+ "t:", 0, 1,
CMD_TARGET_WINDOW_USAGE " [template]",
- CMD_ARG01, "",
- cmd_target_init,
- cmd_target_parse,
- cmd_choose_session_exec,
- cmd_target_free,
- cmd_target_print
+ 0,
+ NULL,
+ NULL,
+ cmd_choose_session_exec
};
struct cmd_choose_session_data {
@@ -50,7 +49,7 @@ struct cmd_choose_session_data {
int
cmd_choose_session_exec(struct cmd *self, struct cmd_ctx *ctx)
{
- struct cmd_target_data *data = self->data;
+ struct args *args = self->args;
struct cmd_choose_session_data *cdata;
struct winlink *wl;
struct session *s;
@@ -63,7 +62,7 @@ cmd_choose_session_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
}
- if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL)
+ if ((wl = cmd_find_window(ctx, args_get(args, 't'), NULL)) == NULL)
return (-1);
if (window_pane_set_mode(wl->window->active, &window_choose_mode) != 0)
@@ -90,8 +89,8 @@ cmd_choose_session_exec(struct cmd *self, struct cmd_ctx *ctx)
}
cdata = xmalloc(sizeof *cdata);
- if (data->arg != NULL)
- cdata->template = xstrdup(data->arg);
+ if (args->argc != 0)
+ cdata->template = xstrdup(args->argv[0]);
else
cdata->template = xstrdup("switch-client -t '%%'");
cdata->client = ctx->curclient;