From: Thomas Adam <thomas.a...@smoothwall.net> Move the choose-session and choose-window commands as wrappers to choose-tree, and remove references to choose-session.c and choose-window.c from the Makefile. --- trunk/Makefile.am | 2 -- trunk/cmd-choose-tree.c | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/trunk/Makefile.am b/trunk/Makefile.am index d1d820c..890e157 100644 --- a/trunk/Makefile.am +++ b/trunk/Makefile.am @@ -66,9 +66,7 @@ dist_tmux_SOURCES = \ cmd-capture-pane.c \ cmd-choose-buffer.c \ cmd-choose-client.c \ - cmd-choose-session.c \ cmd-choose-tree.c \ - cmd-choose-window.c \ cmd-clear-history.c \ cmd-clock-mode.c \ cmd-command-prompt.c \ diff --git a/trunk/cmd-choose-tree.c b/trunk/cmd-choose-tree.c index 4051261..5de71d5 100644 --- a/trunk/cmd-choose-tree.c +++ b/trunk/cmd-choose-tree.c @@ -44,6 +44,26 @@ const struct cmd_entry cmd_choose_tree_entry = { cmd_choose_tree_exec }; +const struct cmd_entry cmd_choose_session_entry = { + "choose-session", NULL, + "Ss:b:t:", 0, 1, + CMD_TARGET_WINDOW_USAGE " [-s format] [-b session template]", + 0, + NULL, + NULL, + cmd_choose_tree_exec +}; + +const struct cmd_entry cmd_choose_window_entry = { + "choose-window", NULL, + "Ww:c:t:", 0, 1, + CMD_TARGET_WINDOW_USAGE "[-W] [-w format] [-c window template]", + 0, + NULL, + NULL, + cmd_choose_tree_exec +}; + int cmd_choose_tree_exec(struct cmd *self, struct cmd_ctx *ctx) { @@ -62,6 +82,10 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_ctx *ctx) ctx->error(ctx, "must be run interactively"); return (-1); } + + sflag = self->entry == &cmd_choose_session_entry; + wflag = self->entry == &cmd_choose_window_entry; + s = ctx->curclient->session; tty = &ctx->curclient->tty; @@ -83,8 +107,16 @@ cmd_choose_tree_exec(struct cmd *self, struct cmd_ctx *ctx) if ((win_template = args_get(args, 'w')) == NULL) win_template = DEFAULT_WINDOW_TEMPLATE " \"#{pane_title}\""; - wflag = args_has(args, 'W'); - sflag = args_has(args, 'S'); + if (self->entry == &cmd_choose_tree_entry) { + wflag = args_has(args, 'W'); + sflag = args_has(args, 'S'); + } + + if (!wflag && !sflag) { + ctx->error(ctx, "Nothing to display, no flags given."); + window_pane_reset_mode(wl->window->active); + return (-1); + } /* If we're drawing in tree mode, including sessions, then pad the * window template with ACS drawing characters, otherwise just render -- 1.7.10 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ tmux-users mailing list tmux-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-users