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

Jameson Rollins jrollins at finestructure.net
Wed Feb 24 06:56:09 PST 2010


On Wed, 24 Feb 2010 15:27:18 +0100 (CET), racin at free.fr wrote:
> > > 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
> > > JSON.
> > 
> > While I would love to see JSON (even by default), I agree. If I just
> > want to code up a notmuch-based address book with sth like:
> > 
> > notmuch show to:Diana --output=to --sort=relevance --limit=20
> > 
> > just getting back a plain list of mail addresses is the easiest to
> > handle.
> 
> This would also be useful for the Emacs/Vim interfaces. For instance, my smart completion patch
> would really benefit from notmuch being capable of outputing various fields in all messages in plain text
> separated by newlines (this is even easier to handle in emacs code than JSON). In fact, most of the C code I had
> to write for this patch is better replaced by the --output option...

Ok, I'm convinced.  I can see how they're both useful.  I had been
thinking more about the fact that text output isn't so useful for
multiline content (like message content), but I can see how it would be
useful for single line output.

I had also been thinking about the fact that the current "text" output,
specifically for the "show" command, *is* structured, but just not
according to any standard that I know of.  If the output is going to be
structured (ie. "show" output) then it should be in JSON format.  If
not, like the output of a single field that is a single line, then
having text output is definitely useful.

jamie.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20100224/e4ba2422/attachment-0001.pgp>


More information about the notmuch mailing list