diff options
author | 2019-03-18 14:10:25 +0000 | |
---|---|---|
committer | 2019-03-18 14:10:25 +0000 | |
commit | 71431f24a7c77d16abf872da635f23c689a953c1 (patch) | |
tree | e731dde25753c248d347a88b21d992a690f5250e /usr.bin/tmux/cmd-display-message.c | |
parent | Insert a missing input line break after a .Vt macro; (diff) | |
download | wireguard-openbsd-71431f24a7c77d16abf872da635f23c689a953c1.tar.xz wireguard-openbsd-71431f24a7c77d16abf872da635f23c689a953c1.zip |
Add format variables for the default formats for the various modes
(tree_mode_format and so on) and add a -a flag to display-message to
list variables with values.
Diffstat (limited to 'usr.bin/tmux/cmd-display-message.c')
-rw-r--r-- | usr.bin/tmux/cmd-display-message.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-display-message.c b/usr.bin/tmux/cmd-display-message.c index 8c2a8819094..b5a741143b0 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.47 2019/03/15 10:04:13 nicm Exp $ */ +/* $OpenBSD: cmd-display-message.c,v 1.48 2019/03/18 14:10:25 nicm Exp $ */ /* * Copyright (c) 2009 Tiago Cunha <me@tiagocunha.org> @@ -39,8 +39,8 @@ const struct cmd_entry cmd_display_message_entry = { .name = "display-message", .alias = "display", - .args = { "c:pt:F:v", 0, 1 }, - .usage = "[-pv] [-c target-client] [-F format] " + .args = { "ac:pt:F:v", 0, 1 }, + .usage = "[-apv] [-c target-client] [-F format] " CMD_TARGET_PANE_USAGE " [message]", .target = { 't', CMD_FIND_PANE, 0 }, @@ -49,6 +49,14 @@ const struct cmd_entry cmd_display_message_entry = { .exec = cmd_display_message_exec }; +static void +cmd_display_message_each(const char *key, const char *value, void *arg) +{ + struct cmdq_item *item = arg; + + cmdq_print(item, "%s=%s", key, value); +} + static enum cmd_retval cmd_display_message_exec(struct cmd *self, struct cmdq_item *item) { @@ -91,6 +99,12 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item) ft = format_create(item->client, item, FORMAT_NONE, flags); format_defaults(ft, target_c, s, wl, wp); + if (args_has(args, 'a')) { + if (item != NULL) + format_each(ft, cmd_display_message_each, item); + return (CMD_RETURN_NORMAL); + } + msg = format_expand_time(ft, template); if (args_has(self->args, 'p')) cmdq_print(item, "%s", msg); |