--- /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 2EC18429E38\r
+ for <notmuch@notmuchmail.org>; Mon, 27 Oct 2014 07:51:35 -0700 (PDT)\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 qD7vzyjmI2rt for <notmuch@notmuchmail.org>;\r
+ Mon, 27 Oct 2014 07:51:31 -0700 (PDT)\r
+Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])\r
+ by olra.theworths.org (Postfix) with ESMTP id 72682431E82\r
+ for <notmuch@notmuchmail.org>; Mon, 27 Oct 2014 07:51:17 -0700 (PDT)\r
+Received: from localhost (unknown [192.168.200.7])\r
+ by max.feld.cvut.cz (Postfix) with ESMTP id 6AAAE5CCF9E\r
+ for <notmuch@notmuchmail.org>; Mon, 27 Oct 2014 15:51:13 +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 xwaXwEKFT3be for <notmuch@notmuchmail.org>;\r
+ Mon, 27 Oct 2014 15:51:08 +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 9A58B5CCF97\r
+ for <notmuch@notmuchmail.org>; Mon, 27 Oct 2014 15:51:07 +0100 (CET)\r
+Received: from wsh by steelpick.2x.cz with local (Exim 4.84)\r
+ (envelope-from <sojkam1@fel.cvut.cz>)\r
+ id 1XildT-0000oe-HZ; Mon, 27 Oct 2014 15:51:07 +0100\r
+From: Michal Sojka <sojkam1@fel.cvut.cz>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v4 3/6] cli: search: Convert --output to keyword-flag argument\r
+Date: Mon, 27 Oct 2014 15:50:52 +0100\r
+Message-Id: <1414421455-3037-4-git-send-email-sojkam1@fel.cvut.cz>\r
+X-Mailer: git-send-email 2.1.1\r
+In-Reply-To: <1414421455-3037-1-git-send-email-sojkam1@fel.cvut.cz>\r
+References: <1414421455-3037-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, 27 Oct 2014 14:51:35 -0000\r
+\r
+This converts "notmuch search" to use the recently introduced\r
+keyword-flag argument parser. At this point, it only makes the code\r
+slightly less readable but following patches that add new --output\r
+keywords will profit from this.\r
+---\r
+ notmuch-search.c | 35 ++++++++++++++++++-----------------\r
+ 1 file changed, 18 insertions(+), 17 deletions(-)\r
+\r
+diff --git a/notmuch-search.c b/notmuch-search.c\r
+index 0c3e972..ce46877 100644\r
+--- a/notmuch-search.c\r
++++ b/notmuch-search.c\r
+@@ -23,11 +23,11 @@\r
+ #include "string-util.h"\r
+ \r
+ typedef enum {\r
+- OUTPUT_SUMMARY,\r
+- OUTPUT_THREADS,\r
+- OUTPUT_MESSAGES,\r
+- OUTPUT_FILES,\r
+- OUTPUT_TAGS\r
++ OUTPUT_SUMMARY = 1 << 0,\r
++ OUTPUT_THREADS = 1 << 1,\r
++ OUTPUT_MESSAGES = 1 << 2,\r
++ OUTPUT_FILES = 1 << 3,\r
++ OUTPUT_TAGS = 1 << 4,\r
+ } output_t;\r
+ \r
+ typedef struct {\r
+@@ -338,7 +338,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
+ notmuch_database_t *notmuch;\r
+ search_options_t opt = {\r
+ .sort = NOTMUCH_SORT_NEWEST_FIRST,\r
+- .output = OUTPUT_SUMMARY,\r
++ .output = 0,\r
+ .offset = 0,\r
+ .limit = -1, /* unlimited */\r
+ .dupe = -1,\r
+@@ -367,7 +367,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
+ { "text0", NOTMUCH_FORMAT_TEXT0 },\r
+ { 0, 0 } } },\r
+ { NOTMUCH_OPT_INT, ¬much_format_version, "format-version", 0, 0 },\r
+- { NOTMUCH_OPT_KEYWORD, &opt.output, "output", 'o',\r
++ { NOTMUCH_OPT_KEYWORD_FLAGS, &opt.output, "output", 'o',\r
+ (notmuch_keyword_t []){ { "summary", OUTPUT_SUMMARY },\r
+ { "threads", OUTPUT_THREADS },\r
+ { "messages", OUTPUT_MESSAGES },\r
+@@ -390,6 +390,9 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
+ if (opt_index < 0)\r
+ return EXIT_FAILURE;\r
+ \r
++ if (! opt.output)\r
++ opt.output = OUTPUT_SUMMARY;\r
++\r
+ switch (format_sel) {\r
+ case NOTMUCH_FORMAT_TEXT:\r
+ opt.format = sprinter_text_create (config, stdout);\r
+@@ -455,19 +458,17 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])\r
+ notmuch_query_set_omit_excluded (opt.query, exclude);\r
+ }\r
+ \r
+- switch (opt.output) {\r
+- default:\r
+- case OUTPUT_SUMMARY:\r
+- case OUTPUT_THREADS:\r
++ if (opt.output == OUTPUT_SUMMARY ||\r
++ opt.output == OUTPUT_THREADS)\r
+ ret = do_search_threads (&opt);\r
+- break;\r
+- case OUTPUT_MESSAGES:\r
+- case OUTPUT_FILES:\r
++ else if (opt.output == OUTPUT_MESSAGES ||\r
++ opt.output == OUTPUT_FILES)\r
+ ret = do_search_messages (&opt);\r
+- break;\r
+- case OUTPUT_TAGS:\r
++ else if (opt.output == OUTPUT_TAGS)\r
+ ret = do_search_tags (notmuch, &opt);\r
+- break;\r
++ else {\r
++ fprintf (stderr, "Error: the combination of outputs is not supported.\n");\r
++ ret = 1;\r
+ }\r
+ \r
+ notmuch_query_destroy (opt.query);\r
+-- \r
+2.1.1\r
+\r