Re: [PATCH v3] notmuch: replace built-in help with exec of man
authorAustin Clements <amdragon@MIT.EDU>
Fri, 30 Dec 2011 18:50:49 +0000 (13:50 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:41:26 +0000 (09:41 -0800)
bc/81520ad75217572ea381eb89235c4b53463eb4 [new file with mode: 0644]

diff --git a/bc/81520ad75217572ea381eb89235c4b53463eb4 b/bc/81520ad75217572ea381eb89235c4b53463eb4
new file mode 100644 (file)
index 0000000..c7ecf32
--- /dev/null
@@ -0,0 +1,636 @@
+Return-Path: <amdragon@mit.edu>\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 E3D11431FD0\r
+       for <notmuch@notmuchmail.org>; Fri, 30 Dec 2011 10:50:13 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 hL8TkqECreLo for <notmuch@notmuchmail.org>;\r
+       Fri, 30 Dec 2011 10:50:12 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
+       [18.9.25.14])\r
+       by olra.theworths.org (Postfix) with ESMTP id C477E431FB6\r
+       for <notmuch@notmuchmail.org>; Fri, 30 Dec 2011 10:50:11 -0800 (PST)\r
+X-AuditID: 1209190e-b7f7c6d0000008c3-36-4efe07e37684\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+       by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id FD.AF.02243.3E70EFE4; Fri, 30 Dec 2011 13:50:11 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id pBUIo9Nv016720; \r
+       Fri, 30 Dec 2011 13:50:10 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id pBUIo8a2021342\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Fri, 30 Dec 2011 13:50:08 -0500 (EST)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1RghXV-0006QZ-Kh; Fri, 30 Dec 2011 13:50:49 -0500\r
+Date: Fri, 30 Dec 2011 13:50:49 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: David Bremner <david@tethera.net>\r
+Subject: Re: [PATCH v3] notmuch: replace built-in help with exec of man\r
+Message-ID: <20111230185049.GK30150@mit.edu>\r
+References: <20111229022419.GI30150@mit.edu>\r
+       <1325164276-31378-1-git-send-email-david@tethera.net>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <1325164276-31378-1-git-send-email-david@tethera.net>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFlrAKsWRmVeSWpSXmKPExsUixG6novuY/Z+fwYd+FouNy34yW9xo7Wa0\r
+       uH5zJrMDs8evtrnMHs9W3WL22HLoPXMAcxSXTUpqTmZZapG+XQJXxpJl69gLXp9mrJh1RreB\r
+       sWc6YxcjJ4eEgInE22W32SFsMYkL99azdTFycQgJ7GOU2DenkQ0kISSwgVGid50AROIkk8Te\r
+       y98YIZwljBLHZp0GG8UioCrR/eIgE4jNJqAhsW3/crC4CFD86rbJYJOYBewlFs2eBLZOWMBd\r
+       ounzPLA4r4COxOLts1kgtqVI/Gx8zw4RF5Q4OfMJC0SvlsSNfy+B5nMA2dISy/9xgIQ5BZwk\r
+       en51gq0SFVCRmHJyG9sERqFZSLpnIemehdC9gJF5FaNsSm6Vbm5iZk5xarJucXJiXl5qka6x\r
+       Xm5miV5qSukmRlCwc0ry7WD8elDpEKMAB6MSD++u13/9hFgTy4orcw8xSnIwKYny3mb75yfE\r
+       l5SfUpmRWJwRX1Sak1p8iFGCg1lJhHf7W6By3pTEyqrUonyYlDQHi5I4r5rWOz8hgfTEktTs\r
+       1NSC1CKYrAwHh5IEbzbIUMGi1PTUirTMnBKENBMHJ8hwHqDht0BqeIsLEnOLM9Mh8qcYjTkW\r
+       ntp8lpHjzlUgKcSSl5+XKiXO+wOkVACkNKM0D24aLGG9YhQHek6Y9x5IFQ8w2cHNewW0iglo\r
+       1blzv0BWlSQipKQaGPX1d3fnuqjneAqlrrnb//1y+8/Ax+38R97yeC3x3j1lipjSuZn/rl+5\r
+       f/OP9VQ+7oT5hR7qyruMGD17Pr0rrF/CatH2wkPy0t0a7TtF/Xf/t7vLTLndZRKysGOm2/+o\r
+       3ZsOW5uJSLWqbzY8FTNj+7Q0t7OCKrJqnyzkrh6xKc9gL/xsLHJoihJLcUaioRZzUXEiAKEo\r
+       LEMzAwAA\r
+Cc: notmuch@notmuchmail.org, David Bremner <bremner@debian.org>\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: Fri, 30 Dec 2011 18:50:14 -0000\r
+\r
+The C side looks good to me (with the updated commit message).  I\r
+can't speak for the nroff side.\r
+\r
+Quoth David Bremner on Dec 29 at  9:11 am:\r
+> From: David Bremner <bremner@debian.org>\r
+> \r
+> Since we lose the fancy scanning of the commands for which ones take\r
+> search terms, the search terms page SYNOPSIS should be updated.\r
+> ---\r
+>  notmuch.c |  482 +++++--------------------------------------------------------\r
+>  1 files changed, 35 insertions(+), 447 deletions(-)\r
+> \r
+> diff --git a/notmuch.c b/notmuch.c\r
+> index c0ce026..477a09c 100644\r
+> --- a/notmuch.c\r
+> +++ b/notmuch.c\r
+> @@ -29,7 +29,6 @@ typedef struct command {\r
+>      command_function_t function;\r
+>      const char *arguments;\r
+>      const char *summary;\r
+> -    const char *documentation;\r
+>  } command_t;\r
+>  \r
+>  #define MAX_ALIAS_SUBSTITUTIONS 3\r
+> @@ -47,447 +46,40 @@ alias_t aliases[] = {\r
+>  static int\r
+>  notmuch_help_command (void *ctx, int argc, char *argv[]);\r
+>  \r
+> -static const char search_terms_help[] =\r
+> -    "\tSeveral notmuch commands accept a common syntax for search\n"\r
+> -    "\tterms.\n"\r
+> -    "\n"\r
+> -    "\tThe search terms can consist of free-form text (and quoted\n"\r
+> -    "\tphrases) which will match all messages that contain all of\n"\r
+> -    "\tthe given terms/phrases in the body, the subject, or any of\n"\r
+> -    "\tthe sender or recipient headers.\n"\r
+> -    "\n"\r
+> -    "\tAs a special case, a search string consisting of exactly a\n"\r
+> -    "\tsingle asterisk (\"*\") will match all messages.\n"\r
+> -    "\n"\r
+> -    "\tIn addition to free text, the following prefixes can be used\n"\r
+> -    "\tto force terms to match against specific portions of an email,\n"\r
+> -    "\t(where <brackets> indicate user-supplied values):\n"\r
+> -    "\n"\r
+> -    "\t\tfrom:<name-or-address>\n"\r
+> -    "\t\tto:<name-or-address>\n"\r
+> -    "\t\tsubject:<word-or-quoted-phrase>\n"\r
+> -    "\t\tattachment:<word>\n"\r
+> -    "\t\ttag:<tag> (or is:<tag>)\n"\r
+> -    "\t\tid:<message-id>\n"\r
+> -    "\t\tthread:<thread-id>\n"\r
+> -    "\t\tfolder:<directory-path>\n"\r
+> -    "\n"\r
+> -    "\tThe from: prefix is used to match the name or address of\n"\r
+> -    "\tthe sender of an email message.\n"\r
+> -    "\n"\r
+> -    "\tThe to: prefix is used to match the names or addresses of\n"\r
+> -    "\tany recipient of an email message, (whether To, Cc, or Bcc).\n"\r
+> -    "\n"\r
+> -    "\tAny term prefixed with subject: will match only text from\n"\r
+> -    "\tthe subject of an email. Quoted phrases are supported when\n"\r
+> -    "\tsearching with: subject:\"this is a phrase\".\n"\r
+> -    "\n"\r
+> -    "\tFor tag: and is:, valid tag values include \"inbox\" and \"unread\"\n"\r
+> -    "\tby default for new messages added by \"notmuch new\" as well\n"\r
+> -    "\tas any other tag values added manually with \"notmuch tag\".\n"\r
+> -    "\n"\r
+> -    "\tFor id:, message ID values are the literal contents of the\n"\r
+> -    "\tMessage-ID: header of email messages, but without the '<','>'\n"\r
+> -    "\tdelimiters.\n"\r
+> -    "\n"\r
+> -    "\tThe thread: prefix can be used with the thread ID values that\n"\r
+> -    "\tare generated internally by notmuch (and do not appear in email\n"\r
+> -    "\tmessages). These thread ID values can be seen in the first\n"\r
+> -    "\tcolumn of output from \"notmuch search\".\n"\r
+> -    "\n"\r
+> -    "\tThe folder: prefix can be used to search for email message\n"\r
+> -    "\tfiles that are contained within particular directories within\n"\r
+> -    "\tthe mail store. Only the directory components below the top-level\n"\r
+> -    "\tmail database path are available to be searched.\n"\r
+> -    "\n"\r
+> -    "\tIn addition to individual terms, multiple terms can be\n"\r
+> -    "\tcombined with Boolean operators (\"and\", \"or\", \"not\", etc.).\n"\r
+> -    "\tEach term in the query will be implicitly connected by a\n"\r
+> -    "\tlogical AND if no explicit operator is provided, (except\n"\r
+> -    "\tthat terms with a common prefix will be implicitly combined\n"\r
+> -    "\twith OR until we get Xapian defect #402 fixed).\n"\r
+> -    "\n"\r
+> -    "\tParentheses can also be used to control the combination of\n"\r
+> -    "\tthe Boolean operators, but will have to be protected from\n"\r
+> -    "\tinterpretation by the shell, (such as by putting quotation\n"\r
+> -    "\tmarks around any parenthesized expression).\n"\r
+> -    "\n"\r
+> -    "\tFinally, results can be restricted to only messages within a\n"\r
+> -    "\tparticular time range, (based on the Date: header) with:\n"\r
+> -    "\n"\r
+> -    "\t\t<intial-timestamp>..<final-timestamp>\n"\r
+> -    "\n"\r
+> -    "\tEach timestamp is a number representing the number of seconds\n"\r
+> -    "\tsince 1970-01-01 00:00:00 UTC. This is not the most convenient\n"\r
+> -    "\tmeans of expressing date ranges, but until notmuch is fixed to\n"\r
+> -    "\taccept a more convenient form, one can use the date program to\n"\r
+> -    "\tconstruct timestamps. For example, with the bash shell the\n"\r
+> -    "\tfollowing syntax would specify a date range to return messages\n"\r
+> -    "\tfrom 2009-10-01 until the current time:\n"\r
+> -    "\n"\r
+> -    "\t\t$(date +%%s -d 2009-10-01)..$(date +%%s)\n\n";\r
+> -\r
+> -static const char hooks_help[] =\r
+> -    "\tHooks are scripts (or arbitrary executables or symlinks to such) that\n"\r
+> -    "\tnotmuch invokes before and after certain actions. These scripts reside\n"\r
+> -    "\tin the .notmuch/hooks directory within the database directory and must\n"\r
+> -    "\thave executable permissions.\n"\r
+> -    "\n"\r
+> -    "\tThe currently available hooks are described below.\n"\r
+> -    "\n"\r
+> -    "\tpre-new\n"\r
+> -    "\t\tThis hook is invoked by the new command before scanning or\n"\r
+> -    "\t\timporting new messages into the database. If this hook exits\n"\r
+> -    "\t\twith a non-zero status, notmuch will abort further processing\n"\r
+> -    "\t\tof the new command.\n"\r
+> -    "\n"\r
+> -    "\t\tTypically this hook is used for fetching or delivering new\n"\r
+> -    "\t\tmail to be imported into the database.\n"\r
+> -    "\n"\r
+> -    "\tpost-new\n"\r
+> -    "\t\tThis hook is invoked by the new command after new messages\n"\r
+> -    "\t\thave been imported into the database and initial tags have\n"\r
+> -    "\t\tbeen applied. The hook will not be run if there have been any\n"\r
+> -    "\t\terrors during the scan or import.\n"\r
+> -    "\n"\r
+> -    "\t\tTypically this hook is used to perform additional query-based\n"\r
+> -    "\t\ttagging on the imported messages.\n\n";\r
+> -\r
+>  static command_t commands[] = {\r
+>      { "setup", notmuch_setup_command,\r
+>        NULL,\r
+> -      "Interactively setup notmuch for first use.",\r
+> -      "\tThe setup command will prompt for your full name, your primary\n"\r
+> -      "\temail address, any alternate email addresses you use, and the\n"\r
+> -      "\tdirectory containing your email archives. Your answers will be\n"\r
+> -      "\twritten to a configuration file in ${NOTMUCH_CONFIG} (if set)\n"\r
+> -      "\tor ${HOME}/.notmuch-config.\n"\r
+> -      "\n"\r
+> -      "\tThis configuration file will be created with descriptive\n"\r
+> -      "\tcomments, making it easy to edit by hand later to change the\n"\r
+> -      "\tconfiguration. Or you can run \"notmuch setup\" again.\n"\r
+> -      "\n"\r
+> -      "\tInvoking notmuch with no command argument will run setup if\n"\r
+> -      "\tthe setup command has not previously been completed." },\r
+> +      "Interactively setup notmuch for first use." },\r
+>      { "new", notmuch_new_command,\r
+>        "[options...]",\r
+> -      "Find and import new messages to the notmuch database.",\r
+> -      "\tScans all sub-directories of the mail directory, performing\n"\r
+> -      "\tfull-text indexing on new messages that are found. Each new\n"\r
+> -      "\tmessage will be tagged as both \"inbox\" and \"unread\".\n"\r
+> -      "\n"\r
+> -      "\tYou should run \"notmuch new\" once after first running\n"\r
+> -      "\t\"notmuch setup\" to create the initial database. The first\n"\r
+> -      "\trun may take a long time if you have a significant amount of\n"\r
+> -      "\tmail (several hundred thousand messages or more).\n"\r
+> -      "\n"\r
+> -      "\tSubsequently, you should run \"notmuch new\" whenever new mail\n"\r
+> -      "\tis delivered and you wish to incorporate it into the database.\n"\r
+> -      "\tThese subsequent runs will be much quicker than the initial run.\n"\r
+> -      "\n"\r
+> -      "\tThe new command supports hooks. See \"notmuch help hooks\" for\n"\r
+> -      "\tmore details on hooks.\n"\r
+> -      "\n"\r
+> -      "\tSupported options for new include:\n"\r
+> -      "\n"\r
+> -      "\t--no-hooks\n"\r
+> -      "\n"\r
+> -      "\t\tPrevent hooks from being run.\n"\r
+> -      "\n"\r
+> -      "\t--verbose\n"\r
+> -      "\n"\r
+> -      "\t\tVerbose operation. Shows paths of message files as\n"\r
+> -      "\t\tthey are being indexed.\n"\r
+> -      "\n"\r
+> -      "\tInvoking notmuch with no command argument will run new if\n"\r
+> -      "\tthe setup command has previously been completed, but new has\n"\r
+> -      "\tnot previously been run." },\r
+> +      "Find and import new messages to the notmuch database." },\r
+>      { "search", notmuch_search_command,\r
+>        "[options...] <search-terms> [...]",\r
+> -      "Search for messages matching the given search terms.",\r
+> -      "\tNote that the individual mail messages will be matched\n"\r
+> -      "\tagainst the search terms, but the results will be the\n"\r
+> -      "\tthreads (one per line) containing the matched messages.\n"\r
+> -      "\n"\r
+> -      "\tSupported options for search include:\n"\r
+> -      "\n"\r
+> -      "\t--format=(json|text)\n"\r
+> -      "\n"\r
+> -      "\t\tPresents the results in either JSON or\n"\r
+> -      "\t\tplain-text (default)\n"\r
+> -      "\n"\r
+> -      "\t--output=(summary|threads|messages|files|tags)\n"\r
+> -      "\n"\r
+> -      "\t\tsummary (default)\n"\r
+> -      "\n"\r
+> -      "\t\tOutput a summary of each thread with any message matching the\n"\r
+> -      "\t\tsearch terms. The summary includes the thread ID, date, the\n"\r
+> -      "\t\tnumber of messages in the thread (both the number matched and\n"\r
+> -      "\t\tthe total number), the authors of the thread and the subject.\n"\r
+> -      "\n"\r
+> -      "\t\tthreads\n"\r
+> -      "\n"\r
+> -      "\t\tOutput the thread IDs of all threads with any message matching\n"\r
+> -      "\t\tthe search terms, either one per line (--format=text) or as a\n"\r
+> -      "\t\tJSON array (--format=json).\n"\r
+> -      "\n"\r
+> -      "\t\tmessages\n"\r
+> -      "\n"\r
+> -      "\t\tOutput the message IDs of all messages matching the search\n"\r
+> -      "\t\tterms, either one per line (--format=text) or as a JSON array\n"\r
+> -      "\t\t(--format=json).\n"\r
+> -      "\n"\r
+> -      "\t\tfiles\n"\r
+> -      "\n"\r
+> -      "\t\tOutput the filenames of all messages matching the search\n"\r
+> -      "\t\tterms, either one per line (--format=text) or as a JSON array\n"\r
+> -      "\t\t(--format=json).\n"\r
+> -      "\n"\r
+> -      "\t\ttags\n"\r
+> -      "\n"\r
+> -      "\t\tOutput all tags that appear on any message matching the search\n"\r
+> -      "\t\tterms, either one per line (--format=text) or as a JSON array\n"\r
+> -      "\t\t(--format=json).\n"\r
+> -      "\n"\r
+> -      "\t--sort=(newest-first|oldest-first)\n"\r
+> -      "\n"\r
+> -      "\t\tPresent results in either chronological order\n"\r
+> -      "\t\t(oldest-first) or reverse chronological order\n"\r
+> -      "\t\t(newest-first), which is the default.\n"\r
+> -      "\n"\r
+> -      "\t--offset=[-]N\n"\r
+> -      "\n"\r
+> -      "\t\tSkip displaying the first N results. With the leading '-',\n"\r
+> -      "\t\tstart at the Nth result from the end.\n"\r
+> -      "\n"\r
+> -      "\t--limit=N\n"\r
+> -      "\n"\r
+> -      "\t\tLimit the number of displayed results to N.\n"\r
+> -      "\n"\r
+> -      "\tSee \"notmuch help search-terms\" for details of the search\n"\r
+> -      "\tterms syntax." },\r
+> +      "Search for messages matching the given search terms." },\r
+>      { "show", notmuch_show_command,\r
+>        "<search-terms> [...]",\r
+> -      "Show all messages matching the search terms.",\r
+> -      "\tThe messages are grouped and sorted based on the threading\n"\r
+> -      "\t(all replies to a particular message appear immediately\n"\r
+> -      "\tafter that message in date order).\n"\r
+> -      "\n"\r
+> -      "\tSupported options for show include:\n"\r
+> -      "\n"\r
+> -      "\t--entire-thread\n"\r
+> -      "\n"\r
+> -      "\t\tBy default only those messages that match the\n"\r
+> -      "\t\tsearch terms will be displayed. With this option,\n"\r
+> -      "\t\tall messages in the same thread as any matched\n"\r
+> -      "\t\tmessage will be displayed.\n"\r
+> -      "\n"\r
+> -      "\t--format=(text|json|mbox|raw)\n"\r
+> -      "\n"\r
+> -      "\t\ttext (default for messages)\n"\r
+> -      "\n"\r
+> -      "\t\tThe default plain-text format has all text-content MIME parts\n"\r
+> -      "\t\tdecoded. Various components in the output, ('message', 'header',\n"\r
+> -      "\t\t'body', 'attachment', and MIME 'part') are delimited by\n"\r
+> -      "\t\teasily-parsed markers. Each marker consists of a Control-L\n"\r
+> -      "\t\tcharacter (ASCII decimal 12), the name of the marker, and\n"\r
+> -      "\t\tthen either an opening or closing brace, '{' or '}' to\n"\r
+> -      "\t\teither open or close the component. For a multipart MIME\n"\r
+> -      "\t\tmessage, these parts will be nested.\n"\r
+> -      "\n"\r
+> -      "\t\tjson\n"\r
+> -      "\n"\r
+> -      "\t\tThe output is formatted with Javascript Object Notation\n"\r
+> -      "\t\t(JSON). This format is more robust than the text format\n"\r
+> -      "\t\tfor automated processing. The nested structure of multipart\n"\r
+> -      "\t\tMIME messages is reflected in nested JSON output. JSON\n"\r
+> -      "\t\toutput always includes all messages in a matching thread;\n"\r
+> -      "\t\tin effect '--format=json' implies '--entire-thread'\n"\r
+> -      "\n"\r
+> -      "\t\tmbox\n"\r
+> -      "\n"\r
+> -      "\t\tAll matching messages are output in the traditional, Unix\n"\r
+> -      "\t\tmbox format with each message being prefixed by a line\n"\r
+> -      "\t\tbeginning with 'From ' and a blank line separating each\n"\r
+> -      "\t\tmessage. Lines in the message content beginning with 'From '\n"\r
+> -      "\t\t(preceded by zero or more '>' characters) have an additional\n"\r
+> -      "\t\t'>' character added. This reversible escaping is termed\n"\r
+> -      "\t\t\"mboxrd\" format and described in detail here:\n"\r
+> -      "\n"\r
+> -      "\t\thttp://homepage.ntlworld.com/jonathan.deboynepollard/FGA/mail-mbox-formats.html\n"\r
+> -      "\n"\r
+> -      "\t\traw (default for a single part, see --part)\n"\r
+> -      "\n"\r
+> -      "\t\tFor a message, the original, raw content of the email\n"\r
+> -      "\t\tmessage is output. Consumers of this format should\n"\r
+> -      "\t\texpect to implement MIME decoding and similar functions.\n"\r
+> -      "\n"\r
+> -      "\t\tFor a single part (--part) the raw part content is output\n"\r
+> -      "\t\tafter performing any necessary MIME decoding.\n"\r
+> -      "\n"\r
+> -      "\t\tThe raw format must only be used with search terms matching\n"\r
+> -      "\t\tsingle message.\n"\r
+> -      "\n"\r
+> -      "\t--part=N\n"\r
+> -      "\n"\r
+> -      "\t\tOutput the single decoded MIME part N of a single message.\n"\r
+> -      "\t\tThe search terms must match only a single message.\n"\r
+> -      "\t\tMessage parts are numbered in a depth-first walk of the\n"\r
+> -      "\t\tmessage MIME structure, and are identified in the 'json' or\n"\r
+> -      "\t\t'text' output formats.\n"\r
+> -      "\n"\r
+> -      "\t--verify\n"\r
+> -      "\n"\r
+> -      "\t\tCompute and report the validity of any MIME cryptographic\n"\r
+> -      "\t\tsignatures found in the selected content (ie.\n"\r
+> -      "\t\t\"multipart/signed\" parts). Status of the signature will be\n"\r
+> -      "\t\treported (currently only supported with --format=json) and\n"\r
+> -      "\t\tthe multipart/signed part will be replaced by the signed data.\n"\r
+> -      "\n"\r
+> -      "\t--decrypt\n"\r
+> -      "\n"\r
+> -      "\t\tDecrypt any MIME encrypted parts found in the selected content\n"\r
+> -      "\t\t(ie. \"multipart/encrypted\" parts). Status of the decryption\n"\r
+> -      "\t\twill be reported (currently only supported with --format=json)\n"\r
+> -      "\t\tand the multipart/encrypted part will be replaced by the\n"\r
+> -      "\t\tdecrypted content.\n"\r
+> -      "\n"\r
+> -      "\n"\r
+> -      "\tA common use of \"notmuch show\" is to display a single\n"\r
+> -      "\tthread of email messages. For this, use a search term of\n"\r
+> -      "\t\"thread:<thread-id>\" as can be seen in the first column\n"\r
+> -      "\tof output from the \"notmuch search\" command.\n"\r
+> -      "\n"\r
+> -      "\tSee \"notmuch help search-terms\" for details of the search\n"\r
+> -      "\tterms syntax." },\r
+> +      "Show all messages matching the search terms." },\r
+>      { "count", notmuch_count_command,\r
+>        "[options...] <search-terms> [...]",\r
+> -      "Count messages matching the search terms.",\r
+> -      "\tThe number of matching messages (or threads) is output to stdout.\n"\r
+> -      "\n"\r
+> -      "\tWith no search terms, a count of all messages (or threads) in\n"\r
+> -      "\tthe database will be displayed.\n"\r
+> -      "\n"\r
+> -      "\tSupported options for count include:\n"\r
+> -      "\n"\r
+> -      "\t--output=(messages|threads)\n"\r
+> -      "\n"\r
+> -      "\t\tmessages (default)\n"\r
+> -      "\n"\r
+> -      "\t\tOutput the number of matching messages.\n"\r
+> -      "\n"\r
+> -      "\t\tthreads\n"\r
+> -      "\n"\r
+> -      "\t\tOutput the number of matching threads.\n"\r
+> -      "\n"\r
+> -      "\tSee \"notmuch help search-terms\" for details of the search\n"\r
+> -      "\tterms syntax." },\r
+> +      "Count messages matching the search terms." },\r
+>      { "reply", notmuch_reply_command,\r
+>        "[options...] <search-terms> [...]",\r
+> -      "Construct a reply template for a set of messages.",\r
+> -      "\tConstructs a new message as a reply to a set of existing\n"\r
+> -      "\tmessages. The Reply-To: header (if any, otherwise From:) is\n"\r
+> -      "\tused for the To: address. The To: and Cc: headers are copied,\n"\r
+> -      "\tbut not including any of the user's configured addresses.\n"\r
+> -      "\n"\r
+> -      "\tA suitable subject is constructed. The In-Reply-to: and\n"\r
+> -      "\tReferences: headers are set appropriately, and the content\n"\r
+> -      "\tof the original messages is quoted and included in the body\n"\r
+> -      "\t(unless --format=headers-only is given).\n"\r
+> -      "\n"\r
+> -      "\tThe resulting message template is output to stdout.\n"\r
+> -      "\n"\r
+> -      "\tSupported options for reply include:\n"\r
+> -      "\n"\r
+> -      "\t--format=(default|headers-only)\n"\r
+> -      "\n"\r
+> -      "\t\tdefault:\n"\r
+> -      "\t\t\tIncludes subject and quoted message body.\n"\r
+> -      "\n"\r
+> -      "\t\theaders-only:\n"\r
+> -      "\t\t\tOnly produces In-Reply-To, References, To\n"\r
+> -      "\t\t\tCc, and Bcc headers.\n"\r
+> -      "\n"\r
+> -      "\tSee \"notmuch help search-terms\" for details of the search\n"\r
+> -      "\tterms syntax." },\r
+> +      "Construct a reply template for a set of messages." },\r
+>      { "tag", notmuch_tag_command,\r
+> -      "+<tag>|-<tag> [...] [--] <search-terms> [...]",\r
+> -      "Add/remove tags for all messages matching the search terms.",\r
+> -      "\tThe search terms are handled exactly as in 'search' so one\n"\r
+> -      "\tcan use that command first to see what will be modified.\n"\r
+> -      "\n"\r
+> -      "\tTags prefixed by '+' are added while those prefixed by\n"\r
+> -      "\t'-' are removed. For each message, tag removal is performed\n"\r
+> -      "\tbefore tag addition.\n"\r
+> -      "\n"\r
+> -      "\tThe beginning of <search-terms> is recognized by the first\n"\r
+> -      "\targument that begins with neither '+' nor '-'. Support for\n"\r
+> -      "\tan initial search term beginning with '+' or '-' is provided\n"\r
+> -      "\tby allowing the user to specify a \"--\" argument to separate\n"\r
+> -      "\tthe tags from the search terms.\n"\r
+> -      "\n"\r
+> -      "\tSee \"notmuch help search-terms\" for details of the search\n"\r
+> -      "\tterms syntax." },\r
+> +      "+<tag>|-<tag> [...] [--] <search-terms> [...]" ,\r
+> +      "Add/remove tags for all messages matching the search terms." },\r
+>      { "dump", notmuch_dump_command,\r
+>        "[<filename>] [--] [<search-terms>]",\r
+> -      "Create a plain-text dump of the tags for each message.",\r
+> -      "\tOutput is to the given filename, if any, or to stdout.\n"\r
+> -      "\tNote that using the filename argument is deprecated.\n"\r
+> -      "\n"\r
+> -      "\tThese tags are the only data in the notmuch database\n"\r
+> -      "\tthat can't be recreated from the messages themselves.\n"\r
+> -      "\tThe output of notmuch dump is therefore the only\n"\r
+> -      "\tcritical thing to backup (and much more friendly to\n"\r
+> -      "\tincremental backup than the native database files.)\n" \r
+> -      "\n"\r
+> -      "\tWith no search terms, a dump of all messages in the\n"\r
+> -      "\tdatabase will be generated. A \"--\" argument instructs\n"\r
+> -      "\tnotmuch that the remaining arguments are search terms.\n"\r
+> -      "\n"\r
+> -      "\tSee \"notmuch help search-terms\" for the search-term syntax.\n"      \r
+> - },\r
+> +      "Create a plain-text dump of the tags for each message." },\r
+>      { "restore", notmuch_restore_command,\r
+>        "[--accumulate] [<filename>]",\r
+> -      "Restore the tags from the given dump file (see 'dump').",\r
+> -      "\tInput is read from the given filename, if any, or from stdin.\n"\r
+> -      "\tNote: The dump file format is specifically chosen to be\n"\r
+> -      "\tcompatible with the format of files produced by sup-dump.\n"\r
+> -      "\tSo if you've previously been using sup for mail, then the\n"\r
+> -      "\t\"notmuch restore\" command provides you a way to import\n"\r
+> -      "\tall of your tags (or labels as sup calls them).\n"\r
+> -      "\tThe --accumulate switch causes the union of the existing and new\n"\r
+> -      "\ttags to be applied, instead of replacing each message's tags as\n"\r
+> -      "\tthey are read in from the dump file."},\r
+> +      "Restore the tags from the given dump file (see 'dump')." },\r
+>      { "config", notmuch_config_command,\r
+>        "[get|set] <section>.<item> [value ...]",\r
+> -      "Get or set settings in the notmuch configuration file.",\r
+> -      "    config get <section>.<item>\n"\r
+> -      "\n"\r
+> -      "\tThe value of the specified configuration item is printed\n"\r
+> -      "\tto stdout. If the item has multiple values, each value\n"\r
+> -      "\tis separated by a newline character.\n"\r
+> -      "\n"\r
+> -      "\tAvailable configuration items include at least\n"\r
+> -      "\n"\r
+> -      "\t\tdatabase.path\n"\r
+> -      "\t\tuser.name\n"\r
+> -      "\t\tuser.primary_email\n"\r
+> -      "\t\tuser.other_email\n"\r
+> -      "\t\tnew.tags\n"\r
+> -      "\n"\r
+> -      "    config set <section>.<item> [value ...]\n"\r
+> -      "\n"\r
+> -      "\tThe specified configuration item is set to the given value.\n"\r
+> -      "\tTo specify a multiple-value item, provide each value as\n"\r
+> -      "\ta separate command-line argument.\n"\r
+> -      "\n"\r
+> -      "\tIf no values are provided, the specified configuration item\n"\r
+> -      "\twill be removed from the configuration file." },\r
+> +      "Get or set settings in the notmuch configuration file." },\r
+>      { "help", notmuch_help_command,\r
+>        "[<command>]",\r
+> -      "This message, or more detailed help for the named command.",\r
+> -      "\tExcept in this case, where there's not much more detailed\n"\r
+> -      "\thelp available." }\r
+> +      "This message, or more detailed help for the named command." }\r
+>  };\r
+>  \r
+>  static void\r
+> @@ -517,8 +109,17 @@ usage (FILE *out)\r
+>      "and \"notmuch help search-terms\" for the common search-terms syntax.\n\n");\r
+>  }\r
+>  \r
+> +static void\r
+> +exec_man (const char *page)\r
+> +{\r
+> +    if (execlp ("man", "man", page, (char *) NULL)) {\r
+> +    perror ("exec man");\r
+> +    exit (1);\r
+> +    }\r
+> +}\r
+> +\r
+>  static int\r
+> -notmuch_help_command (unused (void *ctx), int argc, char *argv[])\r
+> +notmuch_help_command (void *ctx, int argc, char *argv[])\r
+>  {\r
+>      command_t *command;\r
+>      unsigned int i;\r
+> @@ -531,41 +132,28 @@ notmuch_help_command (unused (void *ctx), int argc, char *argv[])\r
+>      return 0;\r
+>      }\r
+>  \r
+> +    if (strcmp (argv[0], "help") == 0) {\r
+> +    printf ("The notmuch help system.\n\n"\r
+> +            "\tNotmuch uses the man command to display help. In case\n"\r
+> +            "\tof difficulties check that MANPATH includes the pages\n"\r
+> +            "\tinstalled by notmuch.\n\n"\r
+> +            "\tTry \"notmuch help\" for a list of topics.\n");\r
+> +    return 0;\r
+> +    }\r
+> +\r
+>      for (i = 0; i < ARRAY_SIZE (commands); i++) {\r
+>      command = &commands[i];\r
+>  \r
+>      if (strcmp (argv[0], command->name) == 0) {\r
+> -        printf ("Help for \"notmuch %s\":\n\n", argv[0]);\r
+> -        if (command->arguments)\r
+> -            printf ("%s %s\n\n\t%s\n\n%s\n\n",\r
+> -                    command->name, command->arguments,\r
+> -                    command->summary, command->documentation);\r
+> -        else\r
+> -            printf ("%s\t%s\n\n%s\n\n", command->name,\r
+> -                    command->summary, command->documentation);\r
+> -        return 0;\r
+> +        char *page = talloc_asprintf (ctx, "notmuch-%s", command->name);\r
+> +        exec_man (page);\r
+>      }\r
+>      }\r
+>  \r
+>      if (strcmp (argv[0], "search-terms") == 0) {\r
+> -    printf ("Help for <%s>\n\n", argv[0]);\r
+> -    for (i = 0; i < ARRAY_SIZE (commands); i++) {\r
+> -        command = &commands[i];\r
+> -\r
+> -        if (command->arguments &&\r
+> -            strstr (command->arguments, "search-terms"))\r
+> -        {\r
+> -            printf ("\t%s\t%s\n",\r
+> -                    command->name, command->arguments);\r
+> -        }\r
+> -    }\r
+> -    printf ("\n");\r
+> -    printf (search_terms_help);\r
+> -    return 0;\r
+> +    exec_man ("notmuch-search-terms");\r
+>      } else if (strcmp (argv[0], "hooks") == 0) {\r
+> -    printf ("Help for <%s>\n\n", argv[0]);\r
+> -    printf (hooks_help);\r
+> -    return 0;\r
+> +    exec_man ("notmuch-hooks");\r
+>      }\r
+>  \r
+>      fprintf (stderr,\r