summaryrefslogtreecommitdiffstats
path: root/cmd-display-message.c
diff options
context:
space:
mode:
authornicm <nicm>2019-03-15 10:04:13 +0000
committernicm <nicm>2019-03-15 10:04:13 +0000
commit27578815dace7addeaaf15227aa102705046f843 (patch)
tree13c829f5c3a4deb722c7b9dc6e8675fc5a2ebc8c /cmd-display-message.c
parent25e2e227913095c79d3c043da84db254c51f9c8c (diff)
Add a -v flag to display-message to show verbose messages as the format
is parsed, this gives the user a way to debug problems with formats rather than just being confronted with (for example) a blank status line.
Diffstat (limited to 'cmd-display-message.c')
-rw-r--r--cmd-display-message.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/cmd-display-message.c b/cmd-display-message.c
index c55cf1e2..07cd12a8 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:", 0, 1 },
- .usage = "[-p] [-c target-client] [-F format] "
+ .args = { "c:pt:F:v", 0, 1 },
+ .usage = "[-pv] [-c target-client] [-F format] "
CMD_TARGET_PANE_USAGE " [message]",
.target = { 't', CMD_FIND_PANE, 0 },
@@ -60,6 +60,7 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
const char *template;
char *msg;
struct format_tree *ft;
+ int flags;
if (args_has(args, 'F') && args->argc != 0) {
cmdq_error(item, "only one of -F or argument must be given");
@@ -83,7 +84,11 @@ cmd_display_message_exec(struct cmd *self, struct cmdq_item *item)
target_c = c;
else
target_c = cmd_find_best_client(s);
- ft = format_create(item->client, item, FORMAT_NONE, 0);
+ if (args_has(self->args, 'v'))
+ flags = FORMAT_VERBOSE;
+ else
+ flags = 0;
+ ft = format_create(item->client, item, FORMAT_NONE, flags);
format_defaults(ft, target_c, s, wl, wp);
msg = format_expand_time(ft, template);