diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2011-03-29 19:30:16 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2011-03-29 19:30:16 +0000 |
commit | d88c20e718f71acf146cb91eda2f818f37003ad0 (patch) | |
tree | ece102e67dfbb7fa22a061da4c4f4feec994c358 /cmd-display-message.c | |
parent | f19a4bf9d1af2f512b841ca9dabdf81592e0f4ea (diff) | |
download | rtmux-d88c20e718f71acf146cb91eda2f818f37003ad0.tar.gz rtmux-d88c20e718f71acf146cb91eda2f818f37003ad0.tar.bz2 rtmux-d88c20e718f71acf146cb91eda2f818f37003ad0.zip |
Change -t on display-message to be target-pane for the #[A-Z]
replacements and add -c as target-client.
Diffstat (limited to 'cmd-display-message.c')
-rw-r--r-- | cmd-display-message.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/cmd-display-message.c b/cmd-display-message.c index baf6fb9d..dfa8312f 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -30,8 +30,8 @@ int cmd_display_message_exec(struct cmd *, struct cmd_ctx *); const struct cmd_entry cmd_display_message_entry = { "display-message", "display", - "pt:", 0, 1, - "[-p] " CMD_TARGET_CLIENT_USAGE " [message]", + "c:pt:", 0, 1, + "[-p] [-c target-client] [-t target-pane] [message]", 0, NULL, NULL, @@ -43,18 +43,31 @@ cmd_display_message_exec(struct cmd *self, struct cmd_ctx *ctx) { struct args *args = self->args; struct client *c; + struct session *s; + struct winlink *wl; + struct window_pane *wp; const char *template; char *msg; - if ((c = cmd_find_client(ctx, args_get(args, 't'))) == NULL) + if ((c = cmd_find_client(ctx, args_get(args, 'c'))) == NULL) return (-1); + if (args_has(args, 't') != NULL) { + wl = cmd_find_pane(ctx, args_get(args, 't'), &s, &wp); + if (wl == NULL) + return (-1); + } else { + s = NULL; + wl = NULL; + wp = NULL; + } + if (args->argc == 0) template = "[#S] #I:#W, current pane #P - (%H:%M %d-%b-%y)"; else template = args->argv[0]; - msg = status_replace(c, NULL, template, time(NULL), 0); + msg = status_replace(c, s, wl, wp, template, time(NULL), 0); if (args_has(self->args, 'p')) ctx->print(ctx, "%s", msg); else |