[PATCH] configure: add --without-api-docs option
[notmuch-archives.git] / 65 / 6663ba24764a167eae05ea49bfe747d2b37305
1 Return-Path: <jani@nikula.org>\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 CE14F429E3F\r
6         for <notmuch@notmuchmail.org>; Sun, 13 Nov 2011 13:16:09 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: -0.7\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
13         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id J69qnOsi2TC7 for <notmuch@notmuchmail.org>;\r
17         Sun, 13 Nov 2011 13:16:07 -0800 (PST)\r
18 Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
19         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id E111B429E3D\r
22         for <notmuch@notmuchmail.org>; Sun, 13 Nov 2011 13:15:54 -0800 (PST)\r
23 Received: by mail-bw0-f53.google.com with SMTP id q10so6289712bka.26\r
24         for <notmuch@notmuchmail.org>; Sun, 13 Nov 2011 13:15:54 -0800 (PST)\r
25 Received: by 10.204.156.208 with SMTP id y16mr16708507bkw.72.1321218954421;\r
26         Sun, 13 Nov 2011 13:15:54 -0800 (PST)\r
27 Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi.\r
28         [80.220.92.23])\r
29         by mx.google.com with ESMTPS id j9sm27632887bkd.2.2011.11.13.13.15.52\r
30         (version=SSLv3 cipher=OTHER); Sun, 13 Nov 2011 13:15:53 -0800 (PST)\r
31 From: Jani Nikula <jani@nikula.org>\r
32 To: notmuch@notmuchmail.org\r
33 Subject: [PATCH v6 4/6] cli: add support for --output parameter in notmuch\r
34         count\r
35 Date: Sun, 13 Nov 2011 23:15:33 +0200\r
36 Message-Id:\r
37  <b92c22c84bd5ae66e6bfb400cb20c87e1ac09c45.1321217854.git.jani@nikula.org>\r
38 X-Mailer: git-send-email 1.7.5.4\r
39 In-Reply-To: <cover.1321217854.git.jani@nikula.org>\r
40 References: <cover.1321217854.git.jani@nikula.org>\r
41 In-Reply-To: <cover.1321217854.git.jani@nikula.org>\r
42 References: <cover.1321217854.git.jani@nikula.org>\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Sun, 13 Nov 2011 21:16:10 -0000\r
56 \r
57 Add support for --output=messages (which remains the default) and\r
58 --output=threads to notmuch count.\r
59 \r
60 Signed-off-by: Jani Nikula <jani@nikula.org>\r
61 ---\r
62  NEWS            |    5 +++++\r
63  notmuch-count.c |   18 ++++++++++++++++--\r
64  notmuch.1       |   29 +++++++++++++++++++++++++----\r
65  notmuch.c       |   20 ++++++++++++++++----\r
66  4 files changed, 62 insertions(+), 10 deletions(-)\r
67 \r
68 diff --git a/NEWS b/NEWS\r
69 index abc749a..78434d9 100644\r
70 --- a/NEWS\r
71 +++ b/NEWS\r
72 @@ -28,6 +28,11 @@ Add "notmuch search" --first and --maxitems options\r
73    The search command now takes options --first=[-]N and --maxitems=N to limit\r
74    the number of results shown.\r
75  \r
76 +Add "notmuch count --output" option\r
77 +\r
78 +  The count command is now capable of counting threads in addition to\r
79 +  messages. This is selected using the new --output=(threads|messages) option.\r
80 +\r
81  Notmuch 0.9 (2011-10-01)\r
82  ========================\r
83  \r
84 diff --git a/notmuch-count.c b/notmuch-count.c\r
85 index a35be40..20ce334 100644\r
86 --- a/notmuch-count.c\r
87 +++ b/notmuch-count.c\r
88 @@ -29,6 +29,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
89      notmuch_query_t *query;\r
90      char *query_str;\r
91      int i;\r
92 +    notmuch_bool_t output_messages = TRUE;\r
93  \r
94      argc--; argv++; /* skip subcommand argument */\r
95  \r
96 @@ -37,7 +38,17 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
97             i++;\r
98             break;\r
99         }\r
100 -       {\r
101 +       if (STRNCMP_LITERAL (argv[i], "--output=") == 0) {\r
102 +           const char *opt = argv[i] + sizeof ("--output=") - 1;\r
103 +           if (strcmp (opt, "threads") == 0) {\r
104 +               output_messages = FALSE;\r
105 +           } else if (strcmp (opt, "messages") == 0) {\r
106 +               output_messages = TRUE;\r
107 +           } else {\r
108 +               fprintf (stderr, "Invalid value for --output: %s\n", opt);\r
109 +               return 1;\r
110 +           }\r
111 +       } else {\r
112             fprintf (stderr, "Unrecognized option: %s\n", argv[i]);\r
113             return 1;\r
114         }\r
115 @@ -71,7 +82,10 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
116         return 1;\r
117      }\r
118  \r
119 -    printf ("%u\n", notmuch_query_count_messages(query));\r
120 +    if (output_messages)\r
121 +       printf ("%u\n", notmuch_query_count_messages (query));\r
122 +    else\r
123 +       printf ("%u\n", notmuch_query_count_threads (query));\r
124  \r
125      notmuch_query_destroy (query);\r
126      notmuch_database_close (notmuch);\r
127 diff --git a/notmuch.1 b/notmuch.1\r
128 index 15c3147..64114db 100644\r
129 --- a/notmuch.1\r
130 +++ b/notmuch.1\r
131 @@ -372,14 +372,35 @@ section below for details of the supported syntax for <search-terms>.\r
132  .RE\r
133  .RS 4\r
134  .TP 4\r
135 -.BR count " <search-term>..."\r
136 +.BR count " [options...] <search-term>..."\r
137  \r
138  Count messages matching the search terms.\r
139  \r
140 -The number of matching messages is output to stdout.\r
141 +The number of matching messages (or threads) is output to stdout.\r
142  \r
143 -With no search terms, a count of all messages in the database will be\r
144 -displayed.\r
145 +With no search terms, a count of all messages (or threads) in the database will\r
146 +be displayed.\r
147 +\r
148 +Supported options for\r
149 +.B count\r
150 +include\r
151 +.RS 4\r
152 +.TP 4\r
153 +.B \-\-output=(messages|threads)\r
154 +\r
155 +.RS 4\r
156 +.TP 4\r
157 +.B messages\r
158 +\r
159 +Output the number of matching messages. This is the default.\r
160 +.RE\r
161 +.RS 4\r
162 +.TP 4\r
163 +.B threads\r
164 +\r
165 +Output the number of matching threads.\r
166 +.RE\r
167 +.RE\r
168  .RE\r
169  .RE\r
170  \r
171 diff --git a/notmuch.c b/notmuch.c\r
172 index 601ffad..0a4ffe9 100644\r
173 --- a/notmuch.c\r
174 +++ b/notmuch.c\r
175 @@ -328,12 +328,24 @@ static command_t commands[] = {\r
176        "\tSee \"notmuch help search-terms\" for details of the search\n"\r
177        "\tterms syntax." },\r
178      { "count", notmuch_count_command,\r
179 -      "<search-terms> [...]",\r
180 +      "[options...] <search-terms> [...]",\r
181        "Count messages matching the search terms.",\r
182 -      "\tThe number of matching messages is output to stdout.\n"\r
183 +      "\tThe number of matching messages (or threads) is output to stdout.\n"\r
184 +      "\n"\r
185 +      "\tWith no search terms, a count of all messages (or threads) in\n"\r
186 +      "\tthe database will be displayed.\n"\r
187 +      "\n"\r
188 +      "\tSupported options for count include:\n"\r
189 +      "\n"\r
190 +      "\t--output=(messages|threads)\n"\r
191 +      "\n"\r
192 +      "\t\tmessages (default)\n"\r
193 +      "\n"\r
194 +      "\t\tOutput the number of matching messages.\n"\r
195 +      "\n"\r
196 +      "\t\tthreads\n"\r
197        "\n"\r
198 -      "\tWith no search terms, a count of all messages in the database\n"\r
199 -      "\twill be displayed.\n"\r
200 +      "\t\tOutput the number of matching threads.\n"\r
201        "\n"\r
202        "\tSee \"notmuch help search-terms\" for details of the search\n"\r
203        "\tterms syntax." },\r
204 -- \r
205 1.7.5.4\r
206 \r