]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch.c
notmuch search: Add a new --output=(summary|threads|messages|tags) option.
[notmuch] / notmuch.c
index f5669fcda2093cf5116f7bb99e7c5674745eb9d3..e92f14c546daaeb88a933432bd193fec17138bd8 100644 (file)
--- a/notmuch.c
+++ b/notmuch.c
@@ -44,6 +44,9 @@ static const char search_terms_help[] =
     "\tthe given terms/phrases in the body, the subject, or any of\n"
     "\tthe sender or recipient headers.\n"
     "\n"
     "\tthe given terms/phrases in the body, the subject, or any of\n"
     "\tthe sender or recipient headers.\n"
     "\n"
+    "\tAs a special case, a search string consisting of exactly a\n"
+    "\tsingle asterisk (\"*\") will match all messages.\n"
+    "\n"
     "\tIn addition to free text, the following prefixes can be used\n"
     "\tto force terms to match against specific portions of an email,\n"
     "\t(where <brackets> indicate user-supplied values):\n"
     "\tIn addition to free text, the following prefixes can be used\n"
     "\tto force terms to match against specific portions of an email,\n"
     "\t(where <brackets> indicate user-supplied values):\n"
@@ -162,6 +165,33 @@ command_t commands[] = {
       "\t\tPresents the results in either JSON or\n"
       "\t\tplain-text (default)\n"
       "\n"
       "\t\tPresents the results in either JSON or\n"
       "\t\tplain-text (default)\n"
       "\n"
+      "\t--output=(summary|threads|messages|tags)\n"
+      "\n"
+      "\t\tsummary (default)\n"
+      "\n"
+      "\t\tOutput a summary of each thread with any message matching the\n"
+      "\t\tsearch terms. The summary includes the thread ID, date, the\n"
+      "\t\tnumber of messages in the thread (both the number matched and\n"
+      "\t\tthe total number), the authors of the thread and the subject.\n"
+      "\n"
+      "\t\tthreads\n"
+      "\n"
+      "\t\tOutput the thread IDs of all threads with any message matching\n"
+      "\t\tthe search terms, either one per line (--format=text) or as a\n"
+      "\t\tJSON array (--format=json).\n"
+      "\n"
+      "\t\tmessages\n"
+      "\n"
+      "\t\tOutput the message IDs of all messages matching the search\n"
+      "\t\tterms, either one per line (--format=text) or as a JSON array\n"
+      "\t\t(--format=json).\n"
+      "\n"
+      "\t\ttags\n"
+      "\n"
+      "\t\tOutput all tags that appear on any message matching the search\n"
+      "\t\tterms, either one per line (--format=text) or as a JSON array\n"
+      "\t\t(--format=json).\n"
+      "\n"
       "\t--sort=(newest-first|oldest-first)\n"
       "\n"
       "\t\tPresent results in either chronological order\n"
       "\t--sort=(newest-first|oldest-first)\n"
       "\n"
       "\t\tPresent results in either chronological order\n"
@@ -186,12 +216,12 @@ command_t commands[] = {
       "\t\tall messages in the same thread as any matched\n"
       "\t\tmessage will be displayed.\n"
       "\n"
       "\t\tall messages in the same thread as any matched\n"
       "\t\tmessage will be displayed.\n"
       "\n"
-      "\t--format=(json|text)\n"
+      "\t--format=(text|json|mbox)\n"
       "\n"
       "\n"
-      "\t\ttext\t(default)\n"
+      "\t\ttext (default)\n"
       "\n"
       "\n"
-      "\t\tThe plain-text has all text-content MIME parts decoded.\n"
-      "\t\tVarious components in the output, ('message', 'header',\n"
+      "\t\tThe default plain-text format has all text-content MIME parts\n"
+      "\t\tdecoded. Various components in the output, ('message', 'header',\n"
       "\t\t'body', 'attachment', and MIME 'part') are delimited by\n"
       "\t\teasily-parsed markers. Each marker consists of a Control-L\n"
       "\t\tcharacter (ASCII decimal 12), the name of the marker, and\n"
       "\t\t'body', 'attachment', and MIME 'part') are delimited by\n"
       "\t\teasily-parsed markers. Each marker consists of a Control-L\n"
       "\t\tcharacter (ASCII decimal 12), the name of the marker, and\n"
@@ -200,9 +230,23 @@ command_t commands[] = {
       "\n"
       "\t\tjson\n"
       "\n"
       "\n"
       "\t\tjson\n"
       "\n"
-      "\t\tFormat output as Javascript Object Notation (JSON).\n"
-      "\t\tJSON output always includes all messages in a matching,\n"
-      "\t\tthread i.e. '--output=json' implies '--entire-thread'\n"
+      "\t\tThe output is formatted with Javascript Object Notation\n"
+      "\t\t(JSON). This format is more robust than the text format\n"
+      "\t\tfor automated processing. JSON output always includes all\n"
+      "\t\tmessages in a matching thread; in effect '--format=json'\n"
+      "\t\timplies '--entire-thread'\n"
+      "\n"
+      "\t\tmbox\n"
+      "\n"
+      "\t\tAll matching messages are output in the traditional, Unix\n"
+      "\t\tmbox format with each message being prefixed by a line\n"
+      "\t\tbeginning with 'From ' and a blank line separating each\n"
+      "\t\tmessage. Lines in the message content beginning with 'From '\n"
+      "\t\t(preceded by zero or more '>' characters) have an additional\n"
+      "\t\t'>' character added. This reversible escaping is termed\n"
+      "\t\t\"mboxrd\" format and described in detail here:\n"
+      "\n"
+      "\t\thttp://homepage.ntlworld.com/jonathan.deboynepollard/FGA/mail-mbox-formats.html\n"
       "\n"
       "\tA common use of \"notmuch show\" is to display a single\n"
       "\tthread of email messages. For this, use a search term of\n"
       "\n"
       "\tA common use of \"notmuch show\" is to display a single\n"
       "\tthread of email messages. For this, use a search term of\n"
@@ -216,12 +260,11 @@ command_t commands[] = {
       "Count messages matching the search terms.",
       "\tThe number of matching messages is output to stdout.\n"
       "\n"
       "Count messages matching the search terms.",
       "\tThe number of matching messages is output to stdout.\n"
       "\n"
-      "\tA common use of \"notmuch count\" is to display the count\n"
-      "\tof messages matching both a specific tag and either inbox\n"
-      "\tor unread\n"
+      "\tWith no search terms, a count of all messages in the database\n"
+      "\twill be displayed.\n"
       "\n"
       "\tSee \"notmuch help search-terms\" for details of the search\n"
       "\n"
       "\tSee \"notmuch help search-terms\" for details of the search\n"
-      "\t\tterms syntax." },
+      "\tterms syntax." },
     { "reply", notmuch_reply_command,
       "[options...] <search-terms> [...]",
       "Construct a reply template for a set of messages.",
     { "reply", notmuch_reply_command,
       "[options...] <search-terms> [...]",
       "Construct a reply template for a set of messages.",
@@ -305,6 +348,31 @@ command_t commands[] = {
       "\tby the \"--format=json\" option of \"notmuch show\". If the\n"
       "\tmessage specified by the search terms does not include a\n"
       "\tpart with the specified \"id\" there will be no output." },
       "\tby the \"--format=json\" option of \"notmuch show\". If the\n"
       "\tmessage specified by the search terms does not include a\n"
       "\tpart with the specified \"id\" there will be no output." },
+    { "config", notmuch_config_command,
+      "[get|set] <section>.<item> [value ...]",
+      "Get or set settings in the notmuch configuration file.",
+      "    config get <section>.<item>\n"
+      "\n"
+      "\tThe value of the specified configuration item is printed\n"
+      "\tto stdout. If the item has multiple values, each value\n"
+      "\tis separated by a newline character.\n"
+      "\n"
+      "\tAvailable configuration items include at least\n"
+      "\n"
+      "\t\tdatabase.path\n"
+      "\t\tuser.name\n"
+      "\t\tuser.primary_email\n"
+      "\t\tuser.other_email\n"
+      "\t\tnew.tags\n"
+      "\n"
+      "    config set <section>.<item> [value ...]\n"
+      "\n"
+      "\tThe specified configuration item is set to the given value.\n"
+      "\tTo specify a multiple-value item, provide each value as\n"
+      "\ta separate command-line argument.\n"
+      "\n"
+      "\tIf no values are provided, the specified configuration item\n"
+      "\twill be removed from the configuration file." },
     { "help", notmuch_help_command,
       "[<command>]",
       "This message, or more detailed help for the named command.",
     { "help", notmuch_help_command,
       "[<command>]",
       "This message, or more detailed help for the named command.",
@@ -472,7 +540,7 @@ main (int argc, char *argv[])
        return notmuch_help_command (NULL, 0, NULL);
 
     if (STRNCMP_LITERAL (argv[1], "--version") == 0) {
        return notmuch_help_command (NULL, 0, NULL);
 
     if (STRNCMP_LITERAL (argv[1], "--version") == 0) {
-       printf ("notmuch version " STRINGIFY(NOTMUCH_VERSION) "\n");
+       printf ("notmuch " STRINGIFY(NOTMUCH_VERSION) "\n");
        return 0;
     }
 
        return 0;
     }