mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
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.
This commit is contained in:
parent
fce47e2e63
commit
87821fce0e
@ -30,8 +30,8 @@ int cmd_display_message_exec(struct cmd *, struct cmd_ctx *);
|
|||||||
|
|
||||||
const struct cmd_entry cmd_display_message_entry = {
|
const struct cmd_entry cmd_display_message_entry = {
|
||||||
"display-message", "display",
|
"display-message", "display",
|
||||||
CMD_TARGET_CLIENT_USAGE " [message]",
|
"[-p] " CMD_TARGET_CLIENT_USAGE " [message]",
|
||||||
CMD_ARG01, "",
|
CMD_ARG01, "p",
|
||||||
cmd_target_init,
|
cmd_target_init,
|
||||||
cmd_target_parse,
|
cmd_target_parse,
|
||||||
cmd_display_message_exec,
|
cmd_display_message_exec,
|
||||||
@ -56,7 +56,10 @@ cmd_display_message_exec(struct cmd *self, struct cmd_ctx *ctx)
|
|||||||
template = data->arg;
|
template = data->arg;
|
||||||
|
|
||||||
msg = status_replace(c, NULL, template, time(NULL), 0);
|
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);
|
xfree(msg);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
8
tmux.1
8
tmux.1
@ -2011,11 +2011,17 @@ Ask for confirmation before executing
|
|||||||
This command works only from inside
|
This command works only from inside
|
||||||
.Nm .
|
.Nm .
|
||||||
.It Xo Ic display-message
|
.It Xo Ic display-message
|
||||||
|
.Op Fl p
|
||||||
.Op Fl t Ar target-client
|
.Op Fl t Ar target-client
|
||||||
.Op Ar message
|
.Op Ar message
|
||||||
.Xc
|
.Xc
|
||||||
.D1 (alias: Ic display )
|
.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
|
The format of
|
||||||
.Ar message
|
.Ar message
|
||||||
is as for
|
is as for
|
||||||
|
Loading…
Reference in New Issue
Block a user