summaryrefslogtreecommitdiffstats
path: root/cmd-break-pane.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-03-12 13:31:09 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-03-12 13:31:09 +0000
commit4e05a2c0ae0017f8b1b501eb9cec0ea8d4ec2ca4 (patch)
treef2fb4c4c0a8bd3b0da3e9c278d4b020ebc71ea6a /cmd-break-pane.c
parent575bfa4b4b6d6f702abf4a6abf6cf1c82bf10b53 (diff)
Add -P/-F flags to break-pane too, from George Nachman.
Diffstat (limited to 'cmd-break-pane.c')
-rw-r--r--cmd-break-pane.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/cmd-break-pane.c b/cmd-break-pane.c
index 6e455ab9..6e6ab589 100644
--- a/cmd-break-pane.c
+++ b/cmd-break-pane.c
@@ -30,8 +30,8 @@ int cmd_break_pane_exec(struct cmd *, struct cmd_ctx *);
const struct cmd_entry cmd_break_pane_entry = {
"break-pane", "breakp",
- "dt:", 0, 0,
- "[-d] " CMD_TARGET_PANE_USAGE,
+ "dPF:t:", 0, 0,
+ "[-dP] [-F format] " CMD_TARGET_PANE_USAGE,
0,
NULL,
NULL,
@@ -49,6 +49,10 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
char *name;
char *cause;
int base_idx;
+ struct client *c;
+ struct format_tree *ft;
+ const char *template;
+ char *cp;
if ((wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp)) == NULL)
return (-1);
@@ -88,5 +92,22 @@ cmd_break_pane_exec(struct cmd *self, struct cmd_ctx *ctx)
server_redraw_session(s);
server_status_session_group(s);
+ if (args_has(args, 'P')) {
+ template = "#{session_name}:#{window_index}";
+ if (args_has(args, 'F'))
+ template = args_get(args, 'F');
+ ft = format_create();
+ if ((c = cmd_find_client(ctx, NULL)) != NULL)
+ format_client(ft, c);
+ format_session(ft, s);
+ format_winlink(ft, s, wl);
+ format_window_pane(ft, wp);
+
+ cp = format_expand(ft, template);
+ ctx->print(ctx, "%s", cp);
+ xfree(cp);
+
+ format_free(ft);
+ }
return (0);
}