--- /dev/null
+Return-Path: <sojkam1@fel.cvut.cz>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 13557431FAF\r
+ for <notmuch@notmuchmail.org>; Mon, 3 Nov 2014 15:51:19 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id Ewmt8mnB6ANk for <notmuch@notmuchmail.org>;\r
+ Mon, 3 Nov 2014 15:51:13 -0800 (PST)\r
+Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
+ by olra.theworths.org (Postfix) with ESMTP id 93155429E34\r
+ for <notmuch@notmuchmail.org>; Mon, 3 Nov 2014 15:50:52 -0800 (PST)\r
+Received: from localhost (unknown [192.168.200.7])\r
+ by max.feld.cvut.cz (Postfix) with ESMTP id 147A55CD008\r
+ for <notmuch@notmuchmail.org>; Tue, 4 Nov 2014 00:50:52 +0100 (CET)\r
+X-Virus-Scanned: IMAP STYX AMAVIS\r
+Received: from max.feld.cvut.cz ([192.168.200.1])\r
+ by localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new,\r
+ port 10044) with ESMTP id USTgdAnh_uU9 for <notmuch@notmuchmail.org>;\r
+ Tue, 4 Nov 2014 00:50:45 +0100 (CET)\r
+Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])\r
+ by max.feld.cvut.cz (Postfix) with ESMTP id E2D2A5CD00B\r
+ for <notmuch@notmuchmail.org>; Tue, 4 Nov 2014 00:50:40 +0100 (CET)\r
+Received: from wsh by steelpick.2x.cz with local (Exim 4.84)\r
+ (envelope-from <sojkam1@fel.cvut.cz>)\r
+ id 1XlROM-0005Wn-6Y; Tue, 04 Nov 2014 00:50:34 +0100\r
+From: Michal Sojka <sojkam1@fel.cvut.cz>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 07/10] cli: search: Convert --output to keyword argument\r
+Date: Tue, 4 Nov 2014 00:50:19 +0100\r
+Message-Id: <1415058622-21162-8-git-send-email-sojkam1@fel.cvut.cz>\r
+X-Mailer: git-send-email 2.1.1\r
+In-Reply-To: <1415058622-21162-1-git-send-email-sojkam1@fel.cvut.cz>\r
+References: <1415058622-21162-1-git-send-email-sojkam1@fel.cvut.cz>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 03 Nov 2014 23:51:19 -0000\r
+\r
+Now, when address related outputs are in a separate command, it makes\r
+no sense to combine multiple --output options in search command line.\r
+Using switch statement to handle different outputs is more readable\r
+than a series of if statements.\r
+---\r
+ doc/man1/notmuch-search.rst | 3 ---\r
+ notmuch-search.c | 25 +++++++++++++------------\r
+ 2 files changed, 13 insertions(+), 15 deletions(-)\r
+\r
+diff --git a/doc/man1/notmuch-search.rst b/doc/man1/notmuch-search.rst\r
+index 65df288..0cc2911 100644\r
+--- a/doc/man1/notmuch-search.rst\r
++++ b/doc/man1/notmuch-search.rst\r
+@@ -78,9 +78,6 @@ Supported options for **search** include\r
+ by null characters (--format=text0), as a JSON array\r
+ (--format=json), or as an S-Expression list (--format=sexp).\r
+ \r
+- This option can be given multiple times to combine different\r
+- outputs.\r
+-\r
+ ``--sort=``\ (**newest-first**\ \|\ **oldest-first**)\r
+ This option can be used to present results in either\r
+ chronological order (**oldest-first**) or reverse chronological\r
+diff --git a/notmuch-search.c b/notmuch-search.c\r
+index cbd84f5..402e860 100644\r
+--- a/notmuch-search.c\r
++++ b/notmuch-search.c\r
+@@ -593,7 +593,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
+ int opt_index, ret;\r
+ \r
+ notmuch_opt_desc_t options[] = {\r
+- { NOTMUCH_OPT_KEYWORD_FLAGS, &ctx->output, "output", 'o',\r
++ { NOTMUCH_OPT_KEYWORD, &ctx->output, "output", 'o',\r
+ (notmuch_keyword_t []){ { "summary", OUTPUT_SUMMARY },\r
+ { "threads", OUTPUT_THREADS },\r
+ { "messages", OUTPUT_MESSAGES },\r
+@@ -607,13 +607,11 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
+ { 0, 0, 0, 0, 0 }\r
+ };\r
+ \r
++ ctx->output = OUTPUT_SUMMARY;\r
+ opt_index = parse_arguments (argc, argv, options, 1);\r
+ if (opt_index < 0)\r
+ return EXIT_FAILURE;\r
+ \r
+- if (! ctx->output)\r
+- ctx->output = OUTPUT_SUMMARY;\r
+-\r
+ if (ctx->output != OUTPUT_FILES && ctx->output != OUTPUT_MESSAGES &&\r
+ ctx->dupe != -1) {\r
+ fprintf (stderr, "Error: --duplicate=N is only supported with --output=files and --output=messages.\n");\r
+@@ -624,17 +622,20 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
+ argc - opt_index, argv + opt_index))\r
+ return EXIT_FAILURE;\r
+ \r
+- if (ctx->output == OUTPUT_SUMMARY ||\r
+- ctx->output == OUTPUT_THREADS)\r
++ switch (ctx->output) {\r
++ case OUTPUT_SUMMARY:\r
++ case OUTPUT_THREADS:\r
+ ret = do_search_threads (ctx);\r
+- else if (ctx->output == OUTPUT_MESSAGES ||\r
+- ctx->output == OUTPUT_FILES)\r
++ break;\r
++ case OUTPUT_MESSAGES:\r
++ case OUTPUT_FILES:\r
+ ret = do_search_messages (ctx);\r
+- else if (ctx->output == OUTPUT_TAGS)\r
++ break;\r
++ case OUTPUT_TAGS:\r
+ ret = do_search_tags (ctx);\r
+- else {\r
+- fprintf (stderr, "Error: the combination of outputs is not supported.\n");\r
+- ret = 1;\r
++ break;\r
++ default:\r
++ INTERNAL_ERROR ("Unexpected output");\r
+ }\r
+ \r
+ _notmuch_search_cleanup (ctx);\r
+-- \r
+2.1.1\r
+\r