aboutsummaryrefslogtreecommitdiff
path: root/notmuch-search.c
diff options
context:
space:
mode:
authorJani Nikula <jani@nikula.org>2017-11-02 20:44:59 +0200
committerDavid Bremner <david@tethera.net>2017-12-14 21:28:50 -0400
commitf3fc97c0008c1d48ccac88c52b5bae61460bfa3f (patch)
treed9db0e79e02c2d03f2cbd4cfe5c90fcc218b7759 /notmuch-search.c
parentab4b033c70eab04c7080aacfbcd362548214340a (diff)
cli: add support for only printing the addresses in notmuch address
The notmuch address output is much more useful for scripts with just the addresses printed. Support this using the --output=address option.
Diffstat (limited to 'notmuch-search.c')
-rw-r--r--notmuch-search.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/notmuch-search.c b/notmuch-search.c
index 0abac08e..8f467db4 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -34,6 +34,7 @@ typedef enum {
OUTPUT_SENDER = 1 << 5,
OUTPUT_RECIPIENTS = 1 << 6,
OUTPUT_COUNT = 1 << 7,
+ OUTPUT_ADDRESS = 1 << 8,
} output_t;
typedef enum {
@@ -370,7 +371,10 @@ print_mailbox (const search_context_t *ctx, const mailbox_t *mailbox)
format->integer (format, count);
format->string (format, "\t");
}
- format->string (format, name_addr);
+ if (ctx->output & OUTPUT_ADDRESS)
+ format->string (format, addr);
+ else
+ format->string (format, name_addr);
format->separator (format);
} else {
format->begin_map (format);
@@ -877,6 +881,7 @@ notmuch_address_command (notmuch_config_t *config, int argc, char *argv[])
(notmuch_keyword_t []){ { "sender", OUTPUT_SENDER },
{ "recipients", OUTPUT_RECIPIENTS },
{ "count", OUTPUT_COUNT },
+ { "address", OUTPUT_ADDRESS },
{ 0, 0 } } },
{ .opt_keyword = &ctx->exclude, .name = "exclude", .keywords =
(notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },