From 2628af573d98f7bdd4db02c7a80c860b867a45fb Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 18 Mar 2019 14:10:25 +0000 Subject: 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. --- cmd-display-message.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'cmd-display-message.c') diff --git a/cmd-display-message.c b/cmd-display-message.c index 07cd12a8..2e935908 100644 --- a/cmd-display-message.c +++ b/cmd-display-message.c @@ -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); -- cgit