[PATCH] cli: notmuch search --duplicate=N is only supported with --output=files

Subject: [PATCH] cli: notmuch search --duplicate=N is only supported with --output=files

Date: Wed, 29 Oct 2014 21:30:43 +0200

To: notmuch@notmuchmail.org, David Edmondson

Cc:

From: Jani Nikula


Check the supported combination, and bail out for other combinations.
---
 notmuch-search.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/notmuch-search.c b/notmuch-search.c
index bc9be4593ecc..3bb5a7fbc885 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -387,6 +387,11 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
     if (opt_index < 0)
 	return EXIT_FAILURE;
 
+    if (output != OUTPUT_FILES && dupe != -1) {
+	fprintf (stderr, "Error: --duplicate=N is only supported with --output=files.\n");
+	return EXIT_FAILURE;
+    }
+
     switch (format_sel) {
     case NOTMUCH_FORMAT_TEXT:
 	format = sprinter_text_create (config, stdout);
-- 
2.1.1


Thread: