[PATCH 1/2] cli: S/MIME verification/decryption support
[notmuch-archives.git] / 1b / cfed8112d7497cbef6a85ed55b695da589ba54
1 Return-Path: <amdragon@mit.edu>\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 D0735429E28\r
6         for <notmuch@notmuchmail.org>; Sun, 13 Nov 2011 08:58:50 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id gE5LayXdop+7 for <notmuch@notmuchmail.org>;\r
16         Sun, 13 Nov 2011 08:58:48 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU\r
18         [18.7.68.34])\r
19         by olra.theworths.org (Postfix) with ESMTP id 6185C431FB6\r
20         for <notmuch@notmuchmail.org>; Sun, 13 Nov 2011 08:58:48 -0800 (PST)\r
21 X-AuditID: 12074422-b7ff56d00000092f-74-4ebff7470902\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id F6.EB.02351.747FFBE4; Sun, 13 Nov 2011 11:58:47 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id pADGwj0O013047; \r
27         Sun, 13 Nov 2011 11:58:46 -0500\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id pADGwiIM020036\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Sun, 13 Nov 2011 11:58:45 -0500 (EST)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1RPdQW-0001dK-F0; Sun, 13 Nov 2011 12:01:04 -0500\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
39 Subject: Re: [PATCH v4 4/6] cli: add support for --output parameter in notmuch\r
40         count\r
41 In-Reply-To:\r
42  <f499964b78d509223c531f1c424e98ed821fd602.1320615322.git.jani@nikula.org>\r
43 References: <cover.1320615322.git.jani@nikula.org>\r
44         <f499964b78d509223c531f1c424e98ed821fd602.1320615322.git.jani@nikula.org>\r
45 User-Agent: Notmuch/0.9+29~g81d35f0 (http://notmuchmail.org) Emacs/23.3.1\r
46         (i486-pc-linux-gnu)\r
47 Date: Sun, 13 Nov 2011 12:01:04 -0500\r
48 Message-ID: <87bosgufcf.fsf@awakening.csail.mit.edu>\r
49 MIME-Version: 1.0\r
50 Content-Type: text/plain; charset=us-ascii\r
51 X-Brightmail-Tracker:\r
52  H4sIAAAAAAAAA+NgFprAKsWRmVeSWpSXmKPExsUixCmqrOv+fb+fwZUX5ha9exezWdxo7Wa0\r
53         +N9cbdE03dlizz4vi+s3ZzI7sHncPc3lManrGZPHrfuv2T2erbrF7DFp7UkWjy2H3jMHsEVx\r
54         2aSk5mSWpRbp2yVwZVxa/4K94LNsxednG5kbGF+LdTFyckgImEjMXL2XHcIWk7hwbz1bFyMX\r
55         h5DAPkaJ0++mskA4Gxgl/v19zQrhnGSSuLVqFlRmCaNE36HXYP1sAhoS2/YvZwSxRQSsJM49\r
56         fA1UxMHBLFAh0XQ5FiQsLBAisWTjSrByToEwiR3tG5hAbCGBGolnfz+A2aICsRJHryxjBGll\r
57         EVCV2NUUAhLmBbp0zt9ZTBC2oMTJmU9YQGxmAS2JG/9eMk1gFJyFJDULSWoBI9MqRtmU3Crd\r
58         3MTMnOLUZN3i5MS8vNQiXVO93MwSvdSU0k2MoIBnd1HawfjzoNIhRgEORiUeXgfp/X5CrIll\r
59         xZW5hxglOZiURHkvfAYK8SXlp1RmJBZnxBeV5qQWH2KU4GBWEuGtXAGU401JrKxKLcqHSUlz\r
60         sCiJ83LtdPATEkhPLEnNTk0tSC2CycpwcChJ8O5/CdQoWJSanlqRlplTgpBm4uAEGc4DNFz/\r
61         Fcjw4oLE3OLMdIj8KUZFKXHeym9ACQGQREZpHlwvLCG9YhQHekWYNxOkigeYzOC6XwENZgIa\r
62         zKKwF2RwSSJCSqqBUc/v/dG+hLe+rME/xf45BYr2b0zZvWkdm3V++oIWi6yWHxafnDZVpK47\r
63         l+5lWXAkr83w6bykOOE9vaJH6+bkWc552nVm+ctWju0N7KwzlYsav86ds8xyjnNZ+d6e+8xF\r
64         jVU2lc4TJLqyqs+wHQ6WYTa77nHtGA/jOq72Cam5CvsmFc2YzxCpxFKckWioxVxUnAgAOUmI\r
65         xiMDAAA=\r
66 X-BeenThere: notmuch@notmuchmail.org\r
67 X-Mailman-Version: 2.1.13\r
68 Precedence: list\r
69 List-Id: "Use and development of the notmuch mail system."\r
70         <notmuch.notmuchmail.org>\r
71 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
73 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
74 List-Post: <mailto:notmuch@notmuchmail.org>\r
75 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
76 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
77         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
78 X-List-Received-Date: Sun, 13 Nov 2011 16:58:51 -0000\r
79 \r
80 Code looks good.  Maybe put messages before threads in the documentation\r
81 (both in the | list and in the descriptions), since that's the default?\r
82 The output documentation for search does that.\r
83 \r
84 "--output" is an unfortunate name for this option since the *output* of\r
85 count is always a count, but this seems necessary for consistency.\r
86 \r
87 On Sun,  6 Nov 2011 23:47:13 +0200, Jani Nikula <jani@nikula.org> wrote:\r
88 > Add support for --output=messages (which remains the default) and\r
89 > --output=threads to notmuch count.\r
90\r
91 > Signed-off-by: Jani Nikula <jani@nikula.org>\r
92 > ---\r
93 >  NEWS            |    5 +++++\r
94 >  notmuch-count.c |   18 ++++++++++++++++--\r
95 >  notmuch.1       |   29 +++++++++++++++++++++++++----\r
96 >  3 files changed, 46 insertions(+), 6 deletions(-)\r
97\r
98 > diff --git a/NEWS b/NEWS\r
99 > index bfdba7b..009811f 100644\r
100 > --- a/NEWS\r
101 > +++ b/NEWS\r
102 > @@ -28,6 +28,11 @@ Add "notmuch search" --first and --maxitems options\r
103 >    The search command now takes options --first=[-]N and --maxitems=N to limit\r
104 >    the number of results shown.\r
105 >  \r
106 > +Add "notmuch count --output" option\r
107 > +\r
108 > +  The count command is now capable of counting threads in addition to\r
109 > +  messages. This is selected using the new --output=(threads|messages) option.\r
110 > +\r
111 >  Notmuch 0.9 (2011-10-01)\r
112 >  ========================\r
113 >  \r
114 > diff --git a/notmuch-count.c b/notmuch-count.c\r
115 > index a35be40..20ce334 100644\r
116 > --- a/notmuch-count.c\r
117 > +++ b/notmuch-count.c\r
118 > @@ -29,6 +29,7 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
119 >      notmuch_query_t *query;\r
120 >      char *query_str;\r
121 >      int i;\r
122 > +    notmuch_bool_t output_messages = TRUE;\r
123 >  \r
124 >      argc--; argv++; /* skip subcommand argument */\r
125 >  \r
126 > @@ -37,7 +38,17 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
127 >           i++;\r
128 >           break;\r
129 >       }\r
130 > -     {\r
131 > +     if (STRNCMP_LITERAL (argv[i], "--output=") == 0) {\r
132 > +         const char *opt = argv[i] + sizeof ("--output=") - 1;\r
133 > +         if (strcmp (opt, "threads") == 0) {\r
134 > +             output_messages = FALSE;\r
135 > +         } else if (strcmp (opt, "messages") == 0) {\r
136 > +             output_messages = TRUE;\r
137 > +         } else {\r
138 > +             fprintf (stderr, "Invalid value for --output: %s\n", opt);\r
139 > +             return 1;\r
140 > +         }\r
141 > +     } else {\r
142 >           fprintf (stderr, "Unrecognized option: %s\n", argv[i]);\r
143 >           return 1;\r
144 >       }\r
145 > @@ -71,7 +82,10 @@ notmuch_count_command (void *ctx, int argc, char *argv[])\r
146 >       return 1;\r
147 >      }\r
148 >  \r
149 > -    printf ("%u\n", notmuch_query_count_messages(query));\r
150 > +    if (output_messages)\r
151 > +     printf ("%u\n", notmuch_query_count_messages (query));\r
152 > +    else\r
153 > +     printf ("%u\n", notmuch_query_count_threads (query));\r
154 >  \r
155 >      notmuch_query_destroy (query);\r
156 >      notmuch_database_close (notmuch);\r
157 > diff --git a/notmuch.1 b/notmuch.1\r
158 > index c97334c..f53c183 100644\r
159 > --- a/notmuch.1\r
160 > +++ b/notmuch.1\r
161 > @@ -374,14 +374,35 @@ section below for details of the supported syntax for <search-terms>.\r
162 >  .RE\r
163 >  .RS 4\r
164 >  .TP 4\r
165 > -.BR count " <search-term>..."\r
166 > +.BR count " [options...] <search-term>..."\r
167 >  \r
168 >  Count messages matching the search terms.\r
169 >  \r
170 > -The number of matching messages is output to stdout.\r
171 > +The number of matching messages (or threads) is output to stdout.\r
172 >  \r
173 > -With no search terms, a count of all messages in the database will be\r
174 > -displayed.\r
175 > +With no search terms, a count of all messages (or threads) in the database will\r
176 > +be displayed.\r
177 > +\r
178 > +Supported options for\r
179 > +.B count\r
180 > +include\r
181 > +.RS 4\r
182 > +.TP 4\r
183 > +.B \-\-output=(threads|messages)\r
184 > +\r
185 > +.RS 4\r
186 > +.TP 4\r
187 > +.B threads\r
188 > +\r
189 > +Output the number of matching threads.\r
190 > +.RE\r
191 > +.RS 4\r
192 > +.TP 4\r
193 > +.B messages\r
194 > +\r
195 > +Output the number of matching messages. This is the default.\r
196 > +.RE\r
197 > +.RE\r
198 >  .RE\r
199 >  .RE\r
200 >  \r
201 > -- \r
202 > 1.7.5.4\r
203\r