Re: [notmuch] [PATCH] Add an "--output=(json|text|)" command-line option to both...
[notmuch-archives.git] / 8f / e3cb8be11c07a19c294ebefc07e44c4257b7ae
diff --git a/8f/e3cb8be11c07a19c294ebefc07e44c4257b7ae b/8f/e3cb8be11c07a19c294ebefc07e44c4257b7ae
new file mode 100644 (file)
index 0000000..625fb3d
--- /dev/null
@@ -0,0 +1,108 @@
+Return-Path: <cworth@cworth.org>\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 A4A77431FBF;\r
+       Fri, 25 Dec 2009 13:33:13 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 bkPIa2Zr9bO2; Fri, 25 Dec 2009 13:33:13 -0800 (PST)\r
+Received: from yoom.home.cworth.org (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id CDF18431FBC;\r
+       Fri, 25 Dec 2009 13:33:12 -0800 (PST)\r
+Received: by yoom.home.cworth.org (Postfix, from userid 1000)\r
+       id 67751254307; Tue, 22 Dec 2009 21:58:53 -0800 (PST)\r
+From: Carl Worth <cworth@cworth.org>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+In-Reply-To: <871virsstp.fsf@pivot.cs.unb.ca>\r
+References: <1261114167-sup-8228@lisa>\r
+       <1261141195-5469-1-git-send-email-david@tethera.net>\r
+       <87iqc4yyo8.fsf@yoom.home.cworth.org> <871virsstp.fsf@pivot.cs.unb.ca>\r
+Date: Tue, 22 Dec 2009 21:58:52 -0800\r
+Message-ID: <87d426nsdf.fsf@yoom.home.cworth.org>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha1; protocol="application/pgp-signature"\r
+Subject: Re: [notmuch] [PATCH] Add an "--output=(json|text|)" command-line\r
+ option to both notmuch-search and notmuch-show.\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\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, 25 Dec 2009 21:33:13 -0000\r
+\r
+--=-=-=\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Fri, 18 Dec 2009 20:36:34 -0400, David Bremner <david@tethera.net> wrote:\r
+> It's a detail, but could you choose two names that are not substrings of\r
+> each other?  Eventually we do want tab completion on the command line to\r
+> work :).\r
+\r
+Yes, that's a good point.\r
+\r
+> Also, "search --for tags foo" suggests to me that\r
+> searching for tags matching foo.  What about using --output for that?\r
+\r
+OK. "--output" sounds good to me here.\r
+\r
+> One thing that is not completely clear to me at this point is what the\r
+> difference is between=20\r
+>=20\r
+>     notmuch search --for messages  search-terms\r
+>=20\r
+> and=20\r
+>=20\r
+>     notmuch show search-terms\r
+\r
+So, "notmuch show <search-terms>" is clear enough---it works as it does\r
+today.\r
+\r
+The new command, ("notmuch search --output=3Dmessages"), would be quite\r
+different. It would have single-line output for each message, (as\r
+"notmuch search" has single line-output already, but for threads by\r
+default). You can see behavior like this in the "notmuch\r
+search-messages" command for which I sent a patch a while ago, (but have\r
+never merged).\r
+\r
+The idea is that "notmuch search" would always give single-line output\r
+suitable for various kinds of processing.\r
+\r
+For example. How much mail have I sent?\r
+\r
+       notmuch search --output=3Dmessages tag:sent | wc -l\r
+\r
+That's something you can't do with a thread-based search, (and it's not\r
+convenient to get a robust result from "notmuch show").\r
+\r
+Once this is combined with a new --format to select what gets printed, I\r
+can imagine a lot of useful things, like collecting email addresses:\r
+\r
+       notmuch search --output=3Dmessages --format=3D"${FROM}" to:cworth@cworth.o=\r
+rg\r
+\r
+or whatever. I can imagine a lot of different queries I'd like to be\r
+able to make of my mail store with things like this.\r
+\r
+=2DCarl\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.10 (GNU/Linux)\r
+\r
+iD8DBQFLMbGd6JDdNq8qSWgRAjB7AKCgsrVNgTYFswiSJXY3i/w7dOUAQgCgoAKC\r
+O/JDJ9YCvzdygtxPMOjeFpY=\r
+=9WWi\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r