[RFC PATCH 3/5] cli: add support for not deduplicating notmuch address results

Jani Nikula jani at nikula.org
Sat Aug 29 07:56:34 PDT 2015


Make it possible to use notmuch address as part of a | sort | uniq -c
pipe instead of forcing --output=count. This is useful for combining
results from multiple notmuch address queries.
---
 notmuch-search.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/notmuch-search.c b/notmuch-search.c
index 36f58eb8d54c..be8afcc0187b 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -355,7 +355,8 @@ process_address_list (const search_context_t *ctx,
 		.count = 0,
 	    };
 
-	    if (is_duplicate (ctx, mbx.name, mbx.addr))
+	    if ((ctx->output & OUTPUT_COUNT || ctx->dupe) &&
+		is_duplicate (ctx, mbx.name, mbx.addr))
 		continue;
 
 	    if (ctx->output & OUTPUT_COUNT)
@@ -755,6 +756,10 @@ notmuch_address_command (notmuch_config_t *config, int argc, char *argv[])
 	  (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },
 				  { "false", NOTMUCH_EXCLUDE_FALSE },
 				  { 0, 0 } } },
+	{ NOTMUCH_OPT_KEYWORD, &ctx->dupe, "deduplicate", 'x',
+	  (notmuch_keyword_t []){ { "yes", -1 },
+				  { "no", 0 },
+				  { 0, 0 } } },
 	{ NOTMUCH_OPT_INHERIT, (void *) &common_options, NULL, 0, 0 },
 	{ NOTMUCH_OPT_INHERIT, (void *) &notmuch_shared_options, NULL, 0, 0 },
 	{ 0, 0, 0, 0, 0 }
-- 
2.1.4



More information about the notmuch mailing list