Hey, Carl. I mentioned this is an email a while back
(id:87eil4ygar.fsf@servo.finestructure.net), 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:
* JSON is a very well spec'd API
* JSON is a *very* well supported standard (it's basically well
supported by every language)
* the JSONformat is perfectly suited for notmuch's output
* emacs has a json.el library, so it would not be hard at all to modify
the notmuch.el to parse json output
* using only one output format would considerably reduce the code base
in notmuch, keeping things simpler and easier to maintain
I think these are pretty good reason to just move to JSON as *the*
output format.
While I'm on this topic, let me rehash another point I made previously:
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:
search --output=thread_id,date,number,author,subject,tags
while the current "show" output could be something like:
search --output=message_id,tags,path,header,body,attachments
This would all make things *much* easier for clients and wrappers. For
instance, here are just a couple of things that would be made much
easier for wrapper scripts:
* Proper maildir sync ("search --output=message_id,tags,path" ...)
* Purging "delete" tagged messages ("search --output=path" tags:delete)
* Moving/archiving messages based on search results ("search --output=path" ...)
I would personally love to see this. I think it would make notmuch
cleaner, simpler, and more powerful all at the same time.
Interested in hearing what other's thoughts on this idea are.
jamie.