summaryrefslogtreecommitdiffstats
path: root/cmd-display-message.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-11-24 19:16:11 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-11-24 19:16:11 +0000
commit87821fce0e3f8d55657fdc4fba39cc1186e2ed3c (patch)
tree9f0cf5fcd40a036dd1de7c5a129842334f67e7dc /cmd-display-message.c
parentfce47e2e6368055e8fdebcfe95a920d953d2f09c (diff)
Add a -p flag to display-message to print the output rather than displaying in
the status line, this allows things like "display -p '#W'" to find the current window index.
Diffstat (limited to 'cmd-display-message.c')
-rw-r--r--cmd-display-message.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/cmd-display-message.c b/cmd-display-message.c
index aa4fd5db..8c42ee6d 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",
- CMD_TARGET_CLIENT_USAGE " [message]",
- CMD_ARG01, "",
+ "[-p] " CMD_TARGET_CLIENT_USAGE " [message]",
+ CMD_ARG01, "p",
cmd_target_init,
cmd_target_parse,
cmd_display_message_exec,
@@ -56,7 +56,10 @@ cmd_display_message_exec(struct cmd *self, struct cmd_ctx *ctx)
template = data->arg;
msg = status_replace(c, NULL, template, time(NULL), 0);
- status_message_set(c, "%s", msg);
+ if (cmd_check_flag(data->chflags, 'p'))
+ ctx->print(ctx, "%s", msg);
+ else
+ status_message_set(c, "%s", msg);
xfree(msg);
return (0);