[PATCH v5 0/6] reworked crypto toggle, plus a few other toggles
[notmuch-archives.git] / bc / 81520ad75217572ea381eb89235c4b53463eb4
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 E3D11431FD0\r
6         for <notmuch@notmuchmail.org>; Fri, 30 Dec 2011 10:50:13 -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 hL8TkqECreLo for <notmuch@notmuchmail.org>;\r
16         Fri, 30 Dec 2011 10:50:12 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
18         [18.9.25.14])\r
19         by olra.theworths.org (Postfix) with ESMTP id C477E431FB6\r
20         for <notmuch@notmuchmail.org>; Fri, 30 Dec 2011 10:50:11 -0800 (PST)\r
21 X-AuditID: 1209190e-b7f7c6d0000008c3-36-4efe07e37684\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id FD.AF.02243.3E70EFE4; Fri, 30 Dec 2011 13:50:11 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id pBUIo9Nv016720; \r
27         Fri, 30 Dec 2011 13:50:10 -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 pBUIo8a2021342\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Fri, 30 Dec 2011 13:50:08 -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 1RghXV-0006QZ-Kh; Fri, 30 Dec 2011 13:50:49 -0500\r
37 Date: Fri, 30 Dec 2011 13:50:49 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: David Bremner <david@tethera.net>\r
40 Subject: Re: [PATCH v3] notmuch: replace built-in help with exec of man\r
41 Message-ID: <20111230185049.GK30150@mit.edu>\r
42 References: <20111229022419.GI30150@mit.edu>\r
43         <1325164276-31378-1-git-send-email-david@tethera.net>\r
44 MIME-Version: 1.0\r
45 Content-Type: text/plain; charset=us-ascii\r
46 Content-Disposition: inline\r
47 In-Reply-To: <1325164276-31378-1-git-send-email-david@tethera.net>\r
48 User-Agent: Mutt/1.5.21 (2010-09-15)\r
49 X-Brightmail-Tracker:\r
50  H4sIAAAAAAAAA+NgFlrAKsWRmVeSWpSXmKPExsUixG6novuY/Z+fwYd+FouNy34yW9xo7Wa0\r
51         uH5zJrMDs8evtrnMHs9W3WL22HLoPXMAcxSXTUpqTmZZapG+XQJXxpJl69gLXp9mrJh1RreB\r
52         sWc6YxcjJ4eEgInE22W32SFsMYkL99azdTFycQgJ7GOU2DenkQ0kISSwgVGid50AROIkk8Te\r
53         y98YIZwljBLHZp0GG8UioCrR/eIgE4jNJqAhsW3/crC4CFD86rbJYJOYBewlFs2eBLZOWMBd\r
54         ounzPLA4r4COxOLts1kgtqVI/Gx8zw4RF5Q4OfMJC0SvlsSNfy+B5nMA2dISy/9xgIQ5BZwk\r
55         en51gq0SFVCRmHJyG9sERqFZSLpnIemehdC9gJF5FaNsSm6Vbm5iZk5xarJucXJiXl5qka6x\r
56         Xm5miV5qSukmRlCwc0ry7WD8elDpEKMAB6MSD++u13/9hFgTy4orcw8xSnIwKYny3mb75yfE\r
57         l5SfUpmRWJwRX1Sak1p8iFGCg1lJhHf7W6By3pTEyqrUonyYlDQHi5I4r5rWOz8hgfTEktTs\r
58         1NSC1CKYrAwHh5IEbzbIUMGi1PTUirTMnBKENBMHJ8hwHqDht0BqeIsLEnOLM9Mh8qcYjTkW\r
59         ntp8lpHjzlUgKcSSl5+XKiXO+wOkVACkNKM0D24aLGG9YhQHek6Y9x5IFQ8w2cHNewW0iglo\r
60         1blzv0BWlSQipKQaGPX1d3fnuqjneAqlrrnb//1y+8/Ax+38R97yeC3x3j1lipjSuZn/rl+5\r
61         f/OP9VQ+7oT5hR7qyruMGD17Pr0rrF/CatH2wkPy0t0a7TtF/Xf/t7vLTLndZRKysGOm2/+o\r
62         3ZsOW5uJSLWqbzY8FTNj+7Q0t7OCKrJqnyzkrh6xKc9gL/xsLHJoihJLcUaioRZzUXEiAKEo\r
63         LEMzAwAA\r
64 Cc: notmuch@notmuchmail.org, David Bremner <bremner@debian.org>\r
65 X-BeenThere: notmuch@notmuchmail.org\r
66 X-Mailman-Version: 2.1.13\r
67 Precedence: list\r
68 List-Id: "Use and development of the notmuch mail system."\r
69         <notmuch.notmuchmail.org>\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
73 List-Post: <mailto:notmuch@notmuchmail.org>\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
76         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
77 X-List-Received-Date: Fri, 30 Dec 2011 18:50:14 -0000\r
78 \r
79 The C side looks good to me (with the updated commit message).  I\r
80 can't speak for the nroff side.\r
81 \r
82 Quoth David Bremner on Dec 29 at  9:11 am:\r
83 > From: David Bremner <bremner@debian.org>\r
84\r
85 > Since we lose the fancy scanning of the commands for which ones take\r
86 > search terms, the search terms page SYNOPSIS should be updated.\r
87 > ---\r
88 >  notmuch.c |  482 +++++--------------------------------------------------------\r
89 >  1 files changed, 35 insertions(+), 447 deletions(-)\r
90\r
91 > diff --git a/notmuch.c b/notmuch.c\r
92 > index c0ce026..477a09c 100644\r
93 > --- a/notmuch.c\r
94 > +++ b/notmuch.c\r
95 > @@ -29,7 +29,6 @@ typedef struct command {\r
96 >      command_function_t function;\r
97 >      const char *arguments;\r
98 >      const char *summary;\r
99 > -    const char *documentation;\r
100 >  } command_t;\r
101 >  \r
102 >  #define MAX_ALIAS_SUBSTITUTIONS 3\r
103 > @@ -47,447 +46,40 @@ alias_t aliases[] = {\r
104 >  static int\r
105 >  notmuch_help_command (void *ctx, int argc, char *argv[]);\r
106 >  \r
107 > -static const char search_terms_help[] =\r
108 > -    "\tSeveral notmuch commands accept a common syntax for search\n"\r
109 > -    "\tterms.\n"\r
110 > -    "\n"\r
111 > -    "\tThe search terms can consist of free-form text (and quoted\n"\r
112 > -    "\tphrases) which will match all messages that contain all of\n"\r
113 > -    "\tthe given terms/phrases in the body, the subject, or any of\n"\r
114 > -    "\tthe sender or recipient headers.\n"\r
115 > -    "\n"\r
116 > -    "\tAs a special case, a search string consisting of exactly a\n"\r
117 > -    "\tsingle asterisk (\"*\") will match all messages.\n"\r
118 > -    "\n"\r
119 > -    "\tIn addition to free text, the following prefixes can be used\n"\r
120 > -    "\tto force terms to match against specific portions of an email,\n"\r
121 > -    "\t(where <brackets> indicate user-supplied values):\n"\r
122 > -    "\n"\r
123 > -    "\t\tfrom:<name-or-address>\n"\r
124 > -    "\t\tto:<name-or-address>\n"\r
125 > -    "\t\tsubject:<word-or-quoted-phrase>\n"\r
126 > -    "\t\tattachment:<word>\n"\r
127 > -    "\t\ttag:<tag> (or is:<tag>)\n"\r
128 > -    "\t\tid:<message-id>\n"\r
129 > -    "\t\tthread:<thread-id>\n"\r
130 > -    "\t\tfolder:<directory-path>\n"\r
131 > -    "\n"\r
132 > -    "\tThe from: prefix is used to match the name or address of\n"\r
133 > -    "\tthe sender of an email message.\n"\r
134 > -    "\n"\r
135 > -    "\tThe to: prefix is used to match the names or addresses of\n"\r
136 > -    "\tany recipient of an email message, (whether To, Cc, or Bcc).\n"\r
137 > -    "\n"\r
138 > -    "\tAny term prefixed with subject: will match only text from\n"\r
139 > -    "\tthe subject of an email. Quoted phrases are supported when\n"\r
140 > -    "\tsearching with: subject:\"this is a phrase\".\n"\r
141 > -    "\n"\r
142 > -    "\tFor tag: and is:, valid tag values include \"inbox\" and \"unread\"\n"\r
143 > -    "\tby default for new messages added by \"notmuch new\" as well\n"\r
144 > -    "\tas any other tag values added manually with \"notmuch tag\".\n"\r
145 > -    "\n"\r
146 > -    "\tFor id:, message ID values are the literal contents of the\n"\r
147 > -    "\tMessage-ID: header of email messages, but without the '<','>'\n"\r
148 > -    "\tdelimiters.\n"\r
149 > -    "\n"\r
150 > -    "\tThe thread: prefix can be used with the thread ID values that\n"\r
151 > -    "\tare generated internally by notmuch (and do not appear in email\n"\r
152 > -    "\tmessages). These thread ID values can be seen in the first\n"\r
153 > -    "\tcolumn of output from \"notmuch search\".\n"\r
154 > -    "\n"\r
155 > -    "\tThe folder: prefix can be used to search for email message\n"\r
156 > -    "\tfiles that are contained within particular directories within\n"\r
157 > -    "\tthe mail store. Only the directory components below the top-level\n"\r
158 > -    "\tmail database path are available to be searched.\n"\r
159 > -    "\n"\r
160 > -    "\tIn addition to individual terms, multiple terms can be\n"\r
161 > -    "\tcombined with Boolean operators (\"and\", \"or\", \"not\", etc.).\n"\r
162 > -    "\tEach term in the query will be implicitly connected by a\n"\r
163 > -    "\tlogical AND if no explicit operator is provided, (except\n"\r
164 > -    "\tthat terms with a common prefix will be implicitly combined\n"\r
165 > -    "\twith OR until we get Xapian defect #402 fixed).\n"\r
166 > -    "\n"\r
167 > -    "\tParentheses can also be used to control the combination of\n"\r
168 > -    "\tthe Boolean operators, but will have to be protected from\n"\r
169 > -    "\tinterpretation by the shell, (such as by putting quotation\n"\r
170 > -    "\tmarks around any parenthesized expression).\n"\r
171 > -    "\n"\r
172 > -    "\tFinally, results can be restricted to only messages within a\n"\r
173 > -    "\tparticular time range, (based on the Date: header) with:\n"\r
174 > -    "\n"\r
175 > -    "\t\t<intial-timestamp>..<final-timestamp>\n"\r
176 > -    "\n"\r
177 > -    "\tEach timestamp is a number representing the number of seconds\n"\r
178 > -    "\tsince 1970-01-01 00:00:00 UTC. This is not the most convenient\n"\r
179 > -    "\tmeans of expressing date ranges, but until notmuch is fixed to\n"\r
180 > -    "\taccept a more convenient form, one can use the date program to\n"\r
181 > -    "\tconstruct timestamps. For example, with the bash shell the\n"\r
182 > -    "\tfollowing syntax would specify a date range to return messages\n"\r
183 > -    "\tfrom 2009-10-01 until the current time:\n"\r
184 > -    "\n"\r
185 > -    "\t\t$(date +%%s -d 2009-10-01)..$(date +%%s)\n\n";\r
186 > -\r
187 > -static const char hooks_help[] =\r
188 > -    "\tHooks are scripts (or arbitrary executables or symlinks to such) that\n"\r
189 > -    "\tnotmuch invokes before and after certain actions. These scripts reside\n"\r
190 > -    "\tin the .notmuch/hooks directory within the database directory and must\n"\r
191 > -    "\thave executable permissions.\n"\r
192 > -    "\n"\r
193 > -    "\tThe currently available hooks are described below.\n"\r
194 > -    "\n"\r
195 > -    "\tpre-new\n"\r
196 > -    "\t\tThis hook is invoked by the new command before scanning or\n"\r
197 > -    "\t\timporting new messages into the database. If this hook exits\n"\r
198 > -    "\t\twith a non-zero status, notmuch will abort further processing\n"\r
199 > -    "\t\tof the new command.\n"\r
200 > -    "\n"\r
201 > -    "\t\tTypically this hook is used for fetching or delivering new\n"\r
202 > -    "\t\tmail to be imported into the database.\n"\r
203 > -    "\n"\r
204 > -    "\tpost-new\n"\r
205 > -    "\t\tThis hook is invoked by the new command after new messages\n"\r
206 > -    "\t\thave been imported into the database and initial tags have\n"\r
207 > -    "\t\tbeen applied. The hook will not be run if there have been any\n"\r
208 > -    "\t\terrors during the scan or import.\n"\r
209 > -    "\n"\r
210 > -    "\t\tTypically this hook is used to perform additional query-based\n"\r
211 > -    "\t\ttagging on the imported messages.\n\n";\r
212 > -\r
213 >  static command_t commands[] = {\r
214 >      { "setup", notmuch_setup_command,\r
215 >        NULL,\r
216 > -      "Interactively setup notmuch for first use.",\r
217 > -      "\tThe setup command will prompt for your full name, your primary\n"\r
218 > -      "\temail address, any alternate email addresses you use, and the\n"\r
219 > -      "\tdirectory containing your email archives. Your answers will be\n"\r
220 > -      "\twritten to a configuration file in ${NOTMUCH_CONFIG} (if set)\n"\r
221 > -      "\tor ${HOME}/.notmuch-config.\n"\r
222 > -      "\n"\r
223 > -      "\tThis configuration file will be created with descriptive\n"\r
224 > -      "\tcomments, making it easy to edit by hand later to change the\n"\r
225 > -      "\tconfiguration. Or you can run \"notmuch setup\" again.\n"\r
226 > -      "\n"\r
227 > -      "\tInvoking notmuch with no command argument will run setup if\n"\r
228 > -      "\tthe setup command has not previously been completed." },\r
229 > +      "Interactively setup notmuch for first use." },\r
230 >      { "new", notmuch_new_command,\r
231 >        "[options...]",\r
232 > -      "Find and import new messages to the notmuch database.",\r
233 > -      "\tScans all sub-directories of the mail directory, performing\n"\r
234 > -      "\tfull-text indexing on new messages that are found. Each new\n"\r
235 > -      "\tmessage will be tagged as both \"inbox\" and \"unread\".\n"\r
236 > -      "\n"\r
237 > -      "\tYou should run \"notmuch new\" once after first running\n"\r
238 > -      "\t\"notmuch setup\" to create the initial database. The first\n"\r
239 > -      "\trun may take a long time if you have a significant amount of\n"\r
240 > -      "\tmail (several hundred thousand messages or more).\n"\r
241 > -      "\n"\r
242 > -      "\tSubsequently, you should run \"notmuch new\" whenever new mail\n"\r
243 > -      "\tis delivered and you wish to incorporate it into the database.\n"\r
244 > -      "\tThese subsequent runs will be much quicker than the initial run.\n"\r
245 > -      "\n"\r
246 > -      "\tThe new command supports hooks. See \"notmuch help hooks\" for\n"\r
247 > -      "\tmore details on hooks.\n"\r
248 > -      "\n"\r
249 > -      "\tSupported options for new include:\n"\r
250 > -      "\n"\r
251 > -      "\t--no-hooks\n"\r
252 > -      "\n"\r
253 > -      "\t\tPrevent hooks from being run.\n"\r
254 > -      "\n"\r
255 > -      "\t--verbose\n"\r
256 > -      "\n"\r
257 > -      "\t\tVerbose operation. Shows paths of message files as\n"\r
258 > -      "\t\tthey are being indexed.\n"\r
259 > -      "\n"\r
260 > -      "\tInvoking notmuch with no command argument will run new if\n"\r
261 > -      "\tthe setup command has previously been completed, but new has\n"\r
262 > -      "\tnot previously been run." },\r
263 > +      "Find and import new messages to the notmuch database." },\r
264 >      { "search", notmuch_search_command,\r
265 >        "[options...] <search-terms> [...]",\r
266 > -      "Search for messages matching the given search terms.",\r
267 > -      "\tNote that the individual mail messages will be matched\n"\r
268 > -      "\tagainst the search terms, but the results will be the\n"\r
269 > -      "\tthreads (one per line) containing the matched messages.\n"\r
270 > -      "\n"\r
271 > -      "\tSupported options for search include:\n"\r
272 > -      "\n"\r
273 > -      "\t--format=(json|text)\n"\r
274 > -      "\n"\r
275 > -      "\t\tPresents the results in either JSON or\n"\r
276 > -      "\t\tplain-text (default)\n"\r
277 > -      "\n"\r
278 > -      "\t--output=(summary|threads|messages|files|tags)\n"\r
279 > -      "\n"\r
280 > -      "\t\tsummary (default)\n"\r
281 > -      "\n"\r
282 > -      "\t\tOutput a summary of each thread with any message matching the\n"\r
283 > -      "\t\tsearch terms. The summary includes the thread ID, date, the\n"\r
284 > -      "\t\tnumber of messages in the thread (both the number matched and\n"\r
285 > -      "\t\tthe total number), the authors of the thread and the subject.\n"\r
286 > -      "\n"\r
287 > -      "\t\tthreads\n"\r
288 > -      "\n"\r
289 > -      "\t\tOutput the thread IDs of all threads with any message matching\n"\r
290 > -      "\t\tthe search terms, either one per line (--format=text) or as a\n"\r
291 > -      "\t\tJSON array (--format=json).\n"\r
292 > -      "\n"\r
293 > -      "\t\tmessages\n"\r
294 > -      "\n"\r
295 > -      "\t\tOutput the message IDs of all messages matching the search\n"\r
296 > -      "\t\tterms, either one per line (--format=text) or as a JSON array\n"\r
297 > -      "\t\t(--format=json).\n"\r
298 > -      "\n"\r
299 > -      "\t\tfiles\n"\r
300 > -      "\n"\r
301 > -      "\t\tOutput the filenames of all messages matching the search\n"\r
302 > -      "\t\tterms, either one per line (--format=text) or as a JSON array\n"\r
303 > -      "\t\t(--format=json).\n"\r
304 > -      "\n"\r
305 > -      "\t\ttags\n"\r
306 > -      "\n"\r
307 > -      "\t\tOutput all tags that appear on any message matching the search\n"\r
308 > -      "\t\tterms, either one per line (--format=text) or as a JSON array\n"\r
309 > -      "\t\t(--format=json).\n"\r
310 > -      "\n"\r
311 > -      "\t--sort=(newest-first|oldest-first)\n"\r
312 > -      "\n"\r
313 > -      "\t\tPresent results in either chronological order\n"\r
314 > -      "\t\t(oldest-first) or reverse chronological order\n"\r
315 > -      "\t\t(newest-first), which is the default.\n"\r
316 > -      "\n"\r
317 > -      "\t--offset=[-]N\n"\r
318 > -      "\n"\r
319 > -      "\t\tSkip displaying the first N results. With the leading '-',\n"\r
320 > -      "\t\tstart at the Nth result from the end.\n"\r
321 > -      "\n"\r
322 > -      "\t--limit=N\n"\r
323 > -      "\n"\r
324 > -      "\t\tLimit the number of displayed results to N.\n"\r
325 > -      "\n"\r
326 > -      "\tSee \"notmuch help search-terms\" for details of the search\n"\r
327 > -      "\tterms syntax." },\r
328 > +      "Search for messages matching the given search terms." },\r
329 >      { "show", notmuch_show_command,\r
330 >        "<search-terms> [...]",\r
331 > -      "Show all messages matching the search terms.",\r
332 > -      "\tThe messages are grouped and sorted based on the threading\n"\r
333 > -      "\t(all replies to a particular message appear immediately\n"\r
334 > -      "\tafter that message in date order).\n"\r
335 > -      "\n"\r
336 > -      "\tSupported options for show include:\n"\r
337 > -      "\n"\r
338 > -      "\t--entire-thread\n"\r
339 > -      "\n"\r
340 > -      "\t\tBy default only those messages that match the\n"\r
341 > -      "\t\tsearch terms will be displayed. With this option,\n"\r
342 > -      "\t\tall messages in the same thread as any matched\n"\r
343 > -      "\t\tmessage will be displayed.\n"\r
344 > -      "\n"\r
345 > -      "\t--format=(text|json|mbox|raw)\n"\r
346 > -      "\n"\r
347 > -      "\t\ttext (default for messages)\n"\r
348 > -      "\n"\r
349 > -      "\t\tThe default plain-text format has all text-content MIME parts\n"\r
350 > -      "\t\tdecoded. Various components in the output, ('message', 'header',\n"\r
351 > -      "\t\t'body', 'attachment', and MIME 'part') are delimited by\n"\r
352 > -      "\t\teasily-parsed markers. Each marker consists of a Control-L\n"\r
353 > -      "\t\tcharacter (ASCII decimal 12), the name of the marker, and\n"\r
354 > -      "\t\tthen either an opening or closing brace, '{' or '}' to\n"\r
355 > -      "\t\teither open or close the component. For a multipart MIME\n"\r
356 > -      "\t\tmessage, these parts will be nested.\n"\r
357 > -      "\n"\r
358 > -      "\t\tjson\n"\r
359 > -      "\n"\r
360 > -      "\t\tThe output is formatted with Javascript Object Notation\n"\r
361 > -      "\t\t(JSON). This format is more robust than the text format\n"\r
362 > -      "\t\tfor automated processing. The nested structure of multipart\n"\r
363 > -      "\t\tMIME messages is reflected in nested JSON output. JSON\n"\r
364 > -      "\t\toutput always includes all messages in a matching thread;\n"\r
365 > -      "\t\tin effect '--format=json' implies '--entire-thread'\n"\r
366 > -      "\n"\r
367 > -      "\t\tmbox\n"\r
368 > -      "\n"\r
369 > -      "\t\tAll matching messages are output in the traditional, Unix\n"\r
370 > -      "\t\tmbox format with each message being prefixed by a line\n"\r
371 > -      "\t\tbeginning with 'From ' and a blank line separating each\n"\r
372 > -      "\t\tmessage. Lines in the message content beginning with 'From '\n"\r
373 > -      "\t\t(preceded by zero or more '>' characters) have an additional\n"\r
374 > -      "\t\t'>' character added. This reversible escaping is termed\n"\r
375 > -      "\t\t\"mboxrd\" format and described in detail here:\n"\r
376 > -      "\n"\r
377 > -      "\t\thttp://homepage.ntlworld.com/jonathan.deboynepollard/FGA/mail-mbox-formats.html\n"\r
378 > -      "\n"\r
379 > -      "\t\traw (default for a single part, see --part)\n"\r
380 > -      "\n"\r
381 > -      "\t\tFor a message, the original, raw content of the email\n"\r
382 > -      "\t\tmessage is output. Consumers of this format should\n"\r
383 > -      "\t\texpect to implement MIME decoding and similar functions.\n"\r
384 > -      "\n"\r
385 > -      "\t\tFor a single part (--part) the raw part content is output\n"\r
386 > -      "\t\tafter performing any necessary MIME decoding.\n"\r
387 > -      "\n"\r
388 > -      "\t\tThe raw format must only be used with search terms matching\n"\r
389 > -      "\t\tsingle message.\n"\r
390 > -      "\n"\r
391 > -      "\t--part=N\n"\r
392 > -      "\n"\r
393 > -      "\t\tOutput the single decoded MIME part N of a single message.\n"\r
394 > -      "\t\tThe search terms must match only a single message.\n"\r
395 > -      "\t\tMessage parts are numbered in a depth-first walk of the\n"\r
396 > -      "\t\tmessage MIME structure, and are identified in the 'json' or\n"\r
397 > -      "\t\t'text' output formats.\n"\r
398 > -      "\n"\r
399 > -      "\t--verify\n"\r
400 > -      "\n"\r
401 > -      "\t\tCompute and report the validity of any MIME cryptographic\n"\r
402 > -      "\t\tsignatures found in the selected content (ie.\n"\r
403 > -      "\t\t\"multipart/signed\" parts). Status of the signature will be\n"\r
404 > -      "\t\treported (currently only supported with --format=json) and\n"\r
405 > -      "\t\tthe multipart/signed part will be replaced by the signed data.\n"\r
406 > -      "\n"\r
407 > -      "\t--decrypt\n"\r
408 > -      "\n"\r
409 > -      "\t\tDecrypt any MIME encrypted parts found in the selected content\n"\r
410 > -      "\t\t(ie. \"multipart/encrypted\" parts). Status of the decryption\n"\r
411 > -      "\t\twill be reported (currently only supported with --format=json)\n"\r
412 > -      "\t\tand the multipart/encrypted part will be replaced by the\n"\r
413 > -      "\t\tdecrypted content.\n"\r
414 > -      "\n"\r
415 > -      "\n"\r
416 > -      "\tA common use of \"notmuch show\" is to display a single\n"\r
417 > -      "\tthread of email messages. For this, use a search term of\n"\r
418 > -      "\t\"thread:<thread-id>\" as can be seen in the first column\n"\r
419 > -      "\tof output from the \"notmuch search\" command.\n"\r
420 > -      "\n"\r
421 > -      "\tSee \"notmuch help search-terms\" for details of the search\n"\r
422 > -      "\tterms syntax." },\r
423 > +      "Show all messages matching the search terms." },\r
424 >      { "count", notmuch_count_command,\r
425 >        "[options...] <search-terms> [...]",\r
426 > -      "Count messages matching the search terms.",\r
427 > -      "\tThe number of matching messages (or threads) is output to stdout.\n"\r
428 > -      "\n"\r
429 > -      "\tWith no search terms, a count of all messages (or threads) in\n"\r
430 > -      "\tthe database will be displayed.\n"\r
431 > -      "\n"\r
432 > -      "\tSupported options for count include:\n"\r
433 > -      "\n"\r
434 > -      "\t--output=(messages|threads)\n"\r
435 > -      "\n"\r
436 > -      "\t\tmessages (default)\n"\r
437 > -      "\n"\r
438 > -      "\t\tOutput the number of matching messages.\n"\r
439 > -      "\n"\r
440 > -      "\t\tthreads\n"\r
441 > -      "\n"\r
442 > -      "\t\tOutput the number of matching threads.\n"\r
443 > -      "\n"\r
444 > -      "\tSee \"notmuch help search-terms\" for details of the search\n"\r
445 > -      "\tterms syntax." },\r
446 > +      "Count messages matching the search terms." },\r
447 >      { "reply", notmuch_reply_command,\r
448 >        "[options...] <search-terms> [...]",\r
449 > -      "Construct a reply template for a set of messages.",\r
450 > -      "\tConstructs a new message as a reply to a set of existing\n"\r
451 > -      "\tmessages. The Reply-To: header (if any, otherwise From:) is\n"\r
452 > -      "\tused for the To: address. The To: and Cc: headers are copied,\n"\r
453 > -      "\tbut not including any of the user's configured addresses.\n"\r
454 > -      "\n"\r
455 > -      "\tA suitable subject is constructed. The In-Reply-to: and\n"\r
456 > -      "\tReferences: headers are set appropriately, and the content\n"\r
457 > -      "\tof the original messages is quoted and included in the body\n"\r
458 > -      "\t(unless --format=headers-only is given).\n"\r
459 > -      "\n"\r
460 > -      "\tThe resulting message template is output to stdout.\n"\r
461 > -      "\n"\r
462 > -      "\tSupported options for reply include:\n"\r
463 > -      "\n"\r
464 > -      "\t--format=(default|headers-only)\n"\r
465 > -      "\n"\r
466 > -      "\t\tdefault:\n"\r
467 > -      "\t\t\tIncludes subject and quoted message body.\n"\r
468 > -      "\n"\r
469 > -      "\t\theaders-only:\n"\r
470 > -      "\t\t\tOnly produces In-Reply-To, References, To\n"\r
471 > -      "\t\t\tCc, and Bcc headers.\n"\r
472 > -      "\n"\r
473 > -      "\tSee \"notmuch help search-terms\" for details of the search\n"\r
474 > -      "\tterms syntax." },\r
475 > +      "Construct a reply template for a set of messages." },\r
476 >      { "tag", notmuch_tag_command,\r
477 > -      "+<tag>|-<tag> [...] [--] <search-terms> [...]",\r
478 > -      "Add/remove tags for all messages matching the search terms.",\r
479 > -      "\tThe search terms are handled exactly as in 'search' so one\n"\r
480 > -      "\tcan use that command first to see what will be modified.\n"\r
481 > -      "\n"\r
482 > -      "\tTags prefixed by '+' are added while those prefixed by\n"\r
483 > -      "\t'-' are removed. For each message, tag removal is performed\n"\r
484 > -      "\tbefore tag addition.\n"\r
485 > -      "\n"\r
486 > -      "\tThe beginning of <search-terms> is recognized by the first\n"\r
487 > -      "\targument that begins with neither '+' nor '-'. Support for\n"\r
488 > -      "\tan initial search term beginning with '+' or '-' is provided\n"\r
489 > -      "\tby allowing the user to specify a \"--\" argument to separate\n"\r
490 > -      "\tthe tags from the search terms.\n"\r
491 > -      "\n"\r
492 > -      "\tSee \"notmuch help search-terms\" for details of the search\n"\r
493 > -      "\tterms syntax." },\r
494 > +      "+<tag>|-<tag> [...] [--] <search-terms> [...]" ,\r
495 > +      "Add/remove tags for all messages matching the search terms." },\r
496 >      { "dump", notmuch_dump_command,\r
497 >        "[<filename>] [--] [<search-terms>]",\r
498 > -      "Create a plain-text dump of the tags for each message.",\r
499 > -      "\tOutput is to the given filename, if any, or to stdout.\n"\r
500 > -      "\tNote that using the filename argument is deprecated.\n"\r
501 > -      "\n"\r
502 > -      "\tThese tags are the only data in the notmuch database\n"\r
503 > -      "\tthat can't be recreated from the messages themselves.\n"\r
504 > -      "\tThe output of notmuch dump is therefore the only\n"\r
505 > -      "\tcritical thing to backup (and much more friendly to\n"\r
506 > -      "\tincremental backup than the native database files.)\n" \r
507 > -      "\n"\r
508 > -      "\tWith no search terms, a dump of all messages in the\n"\r
509 > -      "\tdatabase will be generated. A \"--\" argument instructs\n"\r
510 > -      "\tnotmuch that the remaining arguments are search terms.\n"\r
511 > -      "\n"\r
512 > -      "\tSee \"notmuch help search-terms\" for the search-term syntax.\n"      \r
513 > - },\r
514 > +      "Create a plain-text dump of the tags for each message." },\r
515 >      { "restore", notmuch_restore_command,\r
516 >        "[--accumulate] [<filename>]",\r
517 > -      "Restore the tags from the given dump file (see 'dump').",\r
518 > -      "\tInput is read from the given filename, if any, or from stdin.\n"\r
519 > -      "\tNote: The dump file format is specifically chosen to be\n"\r
520 > -      "\tcompatible with the format of files produced by sup-dump.\n"\r
521 > -      "\tSo if you've previously been using sup for mail, then the\n"\r
522 > -      "\t\"notmuch restore\" command provides you a way to import\n"\r
523 > -      "\tall of your tags (or labels as sup calls them).\n"\r
524 > -      "\tThe --accumulate switch causes the union of the existing and new\n"\r
525 > -      "\ttags to be applied, instead of replacing each message's tags as\n"\r
526 > -      "\tthey are read in from the dump file."},\r
527 > +      "Restore the tags from the given dump file (see 'dump')." },\r
528 >      { "config", notmuch_config_command,\r
529 >        "[get|set] <section>.<item> [value ...]",\r
530 > -      "Get or set settings in the notmuch configuration file.",\r
531 > -      "    config get <section>.<item>\n"\r
532 > -      "\n"\r
533 > -      "\tThe value of the specified configuration item is printed\n"\r
534 > -      "\tto stdout. If the item has multiple values, each value\n"\r
535 > -      "\tis separated by a newline character.\n"\r
536 > -      "\n"\r
537 > -      "\tAvailable configuration items include at least\n"\r
538 > -      "\n"\r
539 > -      "\t\tdatabase.path\n"\r
540 > -      "\t\tuser.name\n"\r
541 > -      "\t\tuser.primary_email\n"\r
542 > -      "\t\tuser.other_email\n"\r
543 > -      "\t\tnew.tags\n"\r
544 > -      "\n"\r
545 > -      "    config set <section>.<item> [value ...]\n"\r
546 > -      "\n"\r
547 > -      "\tThe specified configuration item is set to the given value.\n"\r
548 > -      "\tTo specify a multiple-value item, provide each value as\n"\r
549 > -      "\ta separate command-line argument.\n"\r
550 > -      "\n"\r
551 > -      "\tIf no values are provided, the specified configuration item\n"\r
552 > -      "\twill be removed from the configuration file." },\r
553 > +      "Get or set settings in the notmuch configuration file." },\r
554 >      { "help", notmuch_help_command,\r
555 >        "[<command>]",\r
556 > -      "This message, or more detailed help for the named command.",\r
557 > -      "\tExcept in this case, where there's not much more detailed\n"\r
558 > -      "\thelp available." }\r
559 > +      "This message, or more detailed help for the named command." }\r
560 >  };\r
561 >  \r
562 >  static void\r
563 > @@ -517,8 +109,17 @@ usage (FILE *out)\r
564 >      "and \"notmuch help search-terms\" for the common search-terms syntax.\n\n");\r
565 >  }\r
566 >  \r
567 > +static void\r
568 > +exec_man (const char *page)\r
569 > +{\r
570 > +    if (execlp ("man", "man", page, (char *) NULL)) {\r
571 > +     perror ("exec man");\r
572 > +     exit (1);\r
573 > +    }\r
574 > +}\r
575 > +\r
576 >  static int\r
577 > -notmuch_help_command (unused (void *ctx), int argc, char *argv[])\r
578 > +notmuch_help_command (void *ctx, int argc, char *argv[])\r
579 >  {\r
580 >      command_t *command;\r
581 >      unsigned int i;\r
582 > @@ -531,41 +132,28 @@ notmuch_help_command (unused (void *ctx), int argc, char *argv[])\r
583 >       return 0;\r
584 >      }\r
585 >  \r
586 > +    if (strcmp (argv[0], "help") == 0) {\r
587 > +     printf ("The notmuch help system.\n\n"\r
588 > +             "\tNotmuch uses the man command to display help. In case\n"\r
589 > +             "\tof difficulties check that MANPATH includes the pages\n"\r
590 > +             "\tinstalled by notmuch.\n\n"\r
591 > +             "\tTry \"notmuch help\" for a list of topics.\n");\r
592 > +     return 0;\r
593 > +    }\r
594 > +\r
595 >      for (i = 0; i < ARRAY_SIZE (commands); i++) {\r
596 >       command = &commands[i];\r
597 >  \r
598 >       if (strcmp (argv[0], command->name) == 0) {\r
599 > -         printf ("Help for \"notmuch %s\":\n\n", argv[0]);\r
600 > -         if (command->arguments)\r
601 > -             printf ("%s %s\n\n\t%s\n\n%s\n\n",\r
602 > -                     command->name, command->arguments,\r
603 > -                     command->summary, command->documentation);\r
604 > -         else\r
605 > -             printf ("%s\t%s\n\n%s\n\n", command->name,\r
606 > -                     command->summary, command->documentation);\r
607 > -         return 0;\r
608 > +         char *page = talloc_asprintf (ctx, "notmuch-%s", command->name);\r
609 > +         exec_man (page);\r
610 >       }\r
611 >      }\r
612 >  \r
613 >      if (strcmp (argv[0], "search-terms") == 0) {\r
614 > -     printf ("Help for <%s>\n\n", argv[0]);\r
615 > -     for (i = 0; i < ARRAY_SIZE (commands); i++) {\r
616 > -         command = &commands[i];\r
617 > -\r
618 > -         if (command->arguments &&\r
619 > -             strstr (command->arguments, "search-terms"))\r
620 > -         {\r
621 > -             printf ("\t%s\t%s\n",\r
622 > -                     command->name, command->arguments);\r
623 > -         }\r
624 > -     }\r
625 > -     printf ("\n");\r
626 > -     printf (search_terms_help);\r
627 > -     return 0;\r
628 > +     exec_man ("notmuch-search-terms");\r
629 >      } else if (strcmp (argv[0], "hooks") == 0) {\r
630 > -     printf ("Help for <%s>\n\n", argv[0]);\r
631 > -     printf (hooks_help);\r
632 > -     return 0;\r
633 > +     exec_man ("notmuch-hooks");\r
634 >      }\r
635 >  \r
636 >      fprintf (stderr,\r