[notmuch] [PATCH] Add an "--output=(json|text|)" command-line option to both notmuch-search and notmuch-show.
Carl Worth
cworth at cworth.org
Tue Dec 22 21:58:52 PST 2009
On Fri, 18 Dec 2009 20:36:34 -0400, David Bremner <david at 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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20091222/409c9d49/attachment.pgp>
More information about the notmuch
mailing list