diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-11-24 19:16:12 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2009-11-24 19:16:12 +0000 |
commit | ab751e51ad0a0b72c4183cb8f586aeddc612e359 (patch) | |
tree | 6ad3cc566e446a6ae706470ea513eae43b58974c /usr.bin/tmux | |
parent | b0cb36f0f9d6deb88028b97d745e3a16eed7c78b (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 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/cmd-display-message.c | 11 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 12 |
2 files changed, 16 insertions, 7 deletions
diff --git a/usr.bin/tmux/cmd-display-message.c b/usr.bin/tmux/cmd-display-message.c index 642ab081e92..893cd7b5802 100644 --- a/usr.bin/tmux/cmd-display-message.c +++ b/usr.bin/tmux/cmd-display-message.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd-display-message.c,v 1.6 2009/11/19 16:22:10 nicm Exp $ */ +/* $OpenBSD: cmd-display-message.c,v 1.7 2009/11/24 19:16:11 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -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); diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index 44317d07cfd..447d3388ad7 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.126 2009/11/22 22:52:39 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.127 2009/11/24 19:16:11 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: November 22 2009 $ +.Dd $Mdocdate: November 24 2009 $ .Dt TMUX 1 .Os .Sh NAME @@ -2011,11 +2011,17 @@ Ask for confirmation before executing This command works only from inside .Nm . .It Xo Ic display-message +.Op Fl p .Op Fl t Ar target-client .Op Ar message .Xc .D1 (alias: Ic display ) -Display a message in the status line. +Display a message. +If +.Fl p +is given, the output is printed to stdout, otherwise it is displayed in the +.Ar target-client +status line. The format of .Ar message is as for |