Re: [notmuch] JSON output as default [was: Re: [PATCH] Add an "--output=(json|text|)" command-line option...]

Subject: Re: [notmuch] JSON output as default [was: Re: [PATCH] Add an "--output=(json|text|)" command-line option...]

Date: Tue, 23 Feb 2010 15:35:43 -0800

To: Jameson Rollins,,


From: Carl Worth

On Tue, 23 Feb 2010 16:00:01 -0500, Jameson Rollins <> wrote:
> Hey, Carl.  I mentioned this is an email a while back
> (, but I want to bring it up
> again now that you're looking at the JSON output stuff.  I would like to
> make the case for JSON being the one and only output format.  Here's the
> arguments:

Oh, I'm definitely in favor of killing the %message{ format.

As soon as we get the emacs and vi frontends switched to the json
output, then that old thing can be eliminated.

> * using only one output format would considerably reduce the code base
>   in notmuch, keeping things simpler and easier to maintain

But I actually still want text-only output. It will be even less
"parseable" than the current output, (no delimiters at all), but also
have some niceties like thread indentation, etc.

The idea there is to support direct, human-readable output for quick
command-line use. (It also means that notmuch provides a much gentler
introduction to people just experimenting with it). And I'm willing to
keep the code base just a "little" bit complicated for that.

> If we move to JSON output, it would be *so* sweet to provide means to
> filter the output JSON fields.  The "--output" flag could be used to
> pick the desired output fields.  For instance, the current "search"
> output could be something like:

I definitely want to enable the user to select which fields are printed.

But I don't see how that depends on JSON output. In fact, for easy shell
scripts, etc. I want to be able to do search that give me filenames,
email addresses, etc. without any delimiters at all.

I definitely want to be able to pipe single-field lists coming from
notmuch to grep, xargs, shell for loops, etc. without having to decode

So I'm still in favor of having a "plain text" output going forward,
(and by default).

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