Re: [notmuch] [PATCH] Add an "--output=(json|text|)" command-line option to both notmuch-search and notmuch-show.

Subject: Re: [notmuch] [PATCH] Add an "--output=(json|text|)" command-line option to both notmuch-search and notmuch-show.

Date: Tue, 22 Dec 2009 21:58:52 -0800

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Carl Worth


On Fri, 18 Dec 2009 20:36:34 -0400, David Bremner <david@tethera.net> wrote:
> It's a detail, but could you choose two names that are not substrings of
> each other?  Eventually we do want tab completion on the command line to
> work :).

Yes, that's a good point.

> Also, "search --for tags foo" suggests to me that
> searching for tags matching foo.  What about using --output for that?

OK. "--output" sounds good to me here.

> One thing that is not completely clear to me at this point is what the
> difference is between 
> 
>     notmuch search --for messages  search-terms
> 
> and 
> 
>     notmuch show search-terms

So, "notmuch show <search-terms>" is clear enough---it works as it does
today.

The new command, ("notmuch search --output=messages"), would be quite
different. It would have single-line output for each message, (as
"notmuch search" has single line-output already, but for threads by
default). You can see behavior like this in the "notmuch
search-messages" command for which I sent a patch a while ago, (but have
never merged).

The idea is that "notmuch search" would always give single-line output
suitable for various kinds of processing.

For example. How much mail have I sent?

	notmuch search --output=messages tag:sent | wc -l

That's something you can't do with a thread-based search, (and it's not
convenient to get a robust result from "notmuch show").

Once this is combined with a new --format to select what gets printed, I
can imagine a lot of useful things, like collecting email addresses:

	notmuch search --output=messages --format="${FROM}" to:cworth@cworth.org

or whatever. I can imagine a lot of different queries I'd like to be
able to make of my mail store with things like this.

-Carl
part-000.sig (application/pgp-signature)

Thread: