Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 54D5840D152 for ; Thu, 28 Oct 2010 12:24:56 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.89 X-Spam-Level: X-Spam-Status: No, score=-2.89 tagged_above=-999 required=5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, T_MIME_NO_TEXT=0.01] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XxyK1yAkCeKW for ; Thu, 28 Oct 2010 12:24:46 -0700 (PDT) Received: from yoom.home.cworth.org (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1DD1A40D157 for ; Thu, 28 Oct 2010 12:24:46 -0700 (PDT) Received: by yoom.home.cworth.org (Postfix, from userid 1000) id C3C5F2540F4; Thu, 28 Oct 2010 12:24:45 -0700 (PDT) From: Carl Worth To: notmuch@notmuchmail.org Subject: Notmuch scripters rejoice! New "notmuch search --output=(...)" User-Agent: Notmuch/0.3.1-124-gc9e0da3 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) Date: Thu, 28 Oct 2010 12:24:45 -0700 Message-ID: <8762wmglxe.fsf@yoom.home.cworth.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 19:24:56 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable I just added a new feature to notmuch that I've been wanting for a very long time. It's a new option to "notmuch search" as follows: --output=3D(summary|threads|messages|files|tags) The "summary" value is the default and behaves as "notmuch search" always has, (printing a one-line summary with a bunch of information about each thread). Each of the other options causes "notmuch search" to print only a single value, (thread ID, message ID, filename, or tag), one-per-line[*]. This is intended to be useful in scripts to do things as follows: for spamfile in $(notmuch search tag:spam); do rm $spamfile done Or what have you. I hope people find this useful. See "notmuch help search" for more details. Oh, and with this change, the existing "notmuch search-tags" command is redundant, (it behaves in the same way as "notmuch search =2D-output=3Dtags"). I think I'll drop search-tags from the list of documented commands, (but it probably won't be too painful to continue to support it as a deprecated command name). I'm also wondering about "notmuch count". With the new feature above, one could count matching messages as "notmuch count" does with something like: notmuch search --output=3Dmessages | wc -l That's a bit of a mouthful compared to "notmuch count", but the new command also enables the counting of matching threads: notmuch search --output=3Dthreads | wc -l which is something that "notmuch count" doesn't do. I don't think I'll change "notmuch count". It's probably still useful, (doing what it's documented to do), and it's also likely much more efficient than either of the above "notmuch search" pipelines. =2DCarl [*] Or, when under the influence of --format=3Djson, the results are printed as a single JSON array. =2D-=20 carl.d.worth@intel.com --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iD8DBQFMyc396JDdNq8qSWgRApC+AJ9PjIt7juIEoNaPoh4U1walfTI8LwCeLFCU U89KquzFAmV9eUeaAeu2blE= =JiNM -----END PGP SIGNATURE----- --=-=-=--