[PATCH 0/2] contrib: pick: remove sync parser
[notmuch-archives.git] / 70 / bf86a8e430e6755e07fedf8d9b1616c4de4b73
1 Return-Path: <markwalters1009@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id EC465431FD2\r
6         for <notmuch@notmuchmail.org>; Sat,  7 Apr 2012 09:10:21 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id msy0KcbF6WXz for <notmuch@notmuchmail.org>;\r
18         Sat,  7 Apr 2012 09:10:20 -0700 (PDT)\r
19 Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com\r
20  [74.125.82.45])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
21  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
22  6E8C8431FBC    for <notmuch@notmuchmail.org>; Sat,  7 Apr 2012 09:10:20 -0700\r
23  (PDT)\r
24 Received: by wgbdt14 with SMTP id dt14so822285wgb.2\r
25         for <notmuch@notmuchmail.org>; Sat, 07 Apr 2012 09:10:19 -0700 (PDT)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=yq8Vk74zuiGLhnHZbw3u4pLV1o6O6YCaUEmj30DXz3o=;\r
29         b=gKfXYDLQGyX4a54uTp6w9Axbb36mBhZXj1D7ORWmpojK3cldQLbsHDK0MOe6/4lHr6\r
30         hKe9zIN3r/y83ZrYKD7mfqwGdM4+h5qWgcnGH2dbjfKhCpZiWOtm6tOPmaIQ4Jv1rFQr\r
31         369awzwFuYt8EsGwojwQ0imQMBVSopg+4LVqj+l0lSpsTZ1NWiMEfLSlqn1Mj6yKu2Ar\r
32         R7R3qVpU06kHDM1AbzKioud0uFwFHM6zB7Pg1qbxwoTbo7M4jljIEvWqMl/3d7WdM4jm\r
33         bbu+VuSz0nxWRxzbCFlsqBpVfJEx0f7ISpLe2eCViPqvr02NGtPKmOaDoVwztMgBu3GP\r
34         qgEQ==\r
35 Received: by 10.216.85.81 with SMTP id t59mr1042639wee.28.1333815019125;\r
36         Sat, 07 Apr 2012 09:10:19 -0700 (PDT)\r
37 Received: from localhost (94.197.17.51.threembb.co.uk. [94.197.17.51])\r
38         by mx.google.com with ESMTPS id ca3sm6930586wib.6.2012.04.07.09.10.16\r
39         (version=TLSv1/SSLv3 cipher=OTHER);\r
40         Sat, 07 Apr 2012 09:10:18 -0700 (PDT)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [PATCH v4 2/6] cli: move count to the new --exclude=(true|false|flag)\r
44         naming scheme.\r
45 Date: Sat,  7 Apr 2012 17:10:04 +0100\r
46 Message-Id: <1333815008-24668-3-git-send-email-markwalters1009@gmail.com>\r
47 X-Mailer: git-send-email 1.7.9.1\r
48 In-Reply-To: <1333815008-24668-1-git-send-email-markwalters1009@gmail.com>\r
49 References: <1333815008-24668-1-git-send-email-markwalters1009@gmail.com>\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Sat, 07 Apr 2012 16:10:22 -0000\r
63 \r
64 Move the option --no-exclude to the --exclude= scheme. Since there is\r
65 no way to flag messages only true and false are implemented. Note\r
66 that, for consistency with other commands, this is implemented as a\r
67 keyword option rather than a boolean option.\r
68 ---\r
69  man/man1/notmuch-count.1 |    5 +++--\r
70  notmuch-count.c          |   17 ++++++++++++-----\r
71  test/count               |    4 ++--\r
72  3 files changed, 17 insertions(+), 9 deletions(-)\r
73 \r
74 diff --git a/man/man1/notmuch-count.1 b/man/man1/notmuch-count.1\r
75 index 35ecc53..d6cbf07 100644\r
76 --- a/man/man1/notmuch-count.1\r
77 +++ b/man/man1/notmuch-count.1\r
78 @@ -41,9 +41,10 @@ Output the number of matching threads.\r
79  \r
80  .RS 4\r
81  .TP 4\r
82 -.BR \-\-no\-exclude\r
83 +.BR \-\-exclude=(true|false)\r
84  \r
85 -Do not exclude the messages matching search.exclude_tags in the config file.\r
86 +Specify whether to omit messages matching search.tag_exclude from the\r
87 +count (the default) or not.\r
88  .RE\r
89  .RE\r
90  .RE\r
91 diff --git a/notmuch-count.c b/notmuch-count.c\r
92 index 46b76ae..b76690c 100644\r
93 --- a/notmuch-count.c\r
94 +++ b/notmuch-count.c\r
95 @@ -26,6 +26,12 @@ enum {\r
96      OUTPUT_MESSAGES,\r
97  };\r
98  \r
99 +/* The following is to allow future options to be added more easily */\r
100 +enum {\r
101 +    EXCLUDE_TRUE,\r
102 +    EXCLUDE_FALSE,\r
103 +};\r
104 +\r
105  int\r
106  notmuch_count_command (void *ctx, int argc, char *argv[])\r
107  {\r
108 @@ -35,7 +41,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
109      char *query_str;\r
110      int opt_index;\r
111      int output = OUTPUT_MESSAGES;\r
112 -    notmuch_bool_t no_exclude = FALSE;\r
113 +    int exclude = EXCLUDE_TRUE;\r
114      unsigned int i;\r
115  \r
116      notmuch_opt_desc_t options[] = {\r
117 @@ -43,7 +49,10 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
118           (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },\r
119                                   { "messages", OUTPUT_MESSAGES },\r
120                                   { 0, 0 } } },\r
121 -       { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },\r
122 +       { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x',\r
123 +         (notmuch_keyword_t []){ { "true", EXCLUDE_TRUE },\r
124 +                                 { "false", EXCLUDE_FALSE },\r
125 +                                 { 0, 0 } } },\r
126         { 0, 0, 0, 0, 0 }\r
127      };\r
128  \r
129 @@ -78,7 +87,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
130         return 1;\r
131      }\r
132  \r
133 -    if (!no_exclude) {\r
134 +    if (exclude == EXCLUDE_TRUE) {\r
135         const char **search_exclude_tags;\r
136         size_t search_exclude_tags_length;\r
137  \r
138 @@ -88,8 +97,6 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
139             notmuch_query_add_tag_exclude (query, search_exclude_tags[i]);\r
140      }\r
141  \r
142 -    notmuch_query_set_omit_excluded_messages (query, TRUE);\r
143 -\r
144      switch (output) {\r
145      case OUTPUT_MESSAGES:\r
146         printf ("%u\n", notmuch_query_count_messages (query));\r
147 diff --git a/test/count b/test/count\r
148 index b97fc06..fd387e5 100755\r
149 --- a/test/count\r
150 +++ b/test/count\r
151 @@ -53,9 +53,9 @@ test_expect_equal \\r
152      "1" \\r
153      "`notmuch count subject:deleted and tag:deleted`"\r
154  \r
155 -test_begin_subtest "count \"deleted\" messages, with --no-exclude"\r
156 +test_begin_subtest "count \"deleted\" messages, --exclude=false"\r
157  test_expect_equal \\r
158      "3" \\r
159 -    "`notmuch count --no-exclude subject:deleted`"\r
160 +    "`notmuch count --exclude=false subject:deleted`"\r
161  \r
162  test_done\r
163 -- \r
164 1.7.9.1\r
165 \r