On Sat, Dec 10, 2011 at 22:15, Jameson Graef Rollins
<jroll...@finestructure.net> wrote:
> On Sat, 10 Dec 2011 20:32:22 +0200, Ciprian Dorin Craciun 
> <ciprian.crac...@gmail.com> wrote:
>>     Quick question: why isn't it reasonable to export a **single**
>> email in JSON format (by using the `show` sub-command)? (I mean I
>> understand that in order to be able to correctly parse the output we
>> need only one "object" (i.e. a list of threads, containing a list of
>> emails, etc.). But there might be use cases in which we need a
>> "twist".)
>
> Hi, Ciprian.  I agree that it would be nice too have the ability to
> output single messages without the rest of their thread.  I have on
> occasion wanted this functionality, but never enough to get around to
> implementing it.  It definitely wouldn't be that hard to implement,
> though.
>
> The notmuch show function is actually going through a pretty major
> overhaul at the moment.  I bet as soon as that's done we can get some
> sort of single-message output going.
>
> jamie.


    I've given a quick look into `notmuch-show.c` (commit from
December 4) and indeed it seems quite trivial to add new formats.

    Thus I wonder:
    a) Is the code suitable for experimenting such a feature? (I mean
is the "overhaul" almost done, or still in progress?)
    b) What would be the estimate for the "overhaul" completion? (To
start prototyping such a feature...)
    c) Would someone else be interested in such a feature? (Or it's
something so remote that only the two of us stumbled upon it?)

    I think it's quite hard to get this feature "right". I.e. I can
see the following different -- but equally likely -- use-cases:
    * in my use-case I would need each line of the output to be a
standalone JSON object of an individual message; (thus I can script
with Bash `notmuch ... | while read message ; do ... ; done`;)
    * maybe someone else would need that the output to contain
**exactly one** such message (maybe the first);
    * and maybe for someone else the use case involves having no
`--entire-thread` by default;
    * further more someone else would actually prefer a "flatten" list
of messages (not the currently nested list);
    * or maybe the separator in the first use case should be `\0`
instead of `\n`;

    Thanks,
    Ciprian.

    P.S.: I think all sub-commands that output line-feed separated
records should also have the option to split them instead with `\0`.
(I.e. `xargs` insists upon this I think, if not it separates by space
or new-line.)
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch

Reply via email to