Re: About the json output and the number of results shown.

Subject: Re: About the json output and the number of results shown.

Date: Sat, 29 Jan 2011 06:44:40 +1000

To: Mike Kelly, notmuch@notmuchmail.org

Cc:

From: Carl Worth


On Wed, 12 Jan 2011 22:39:45 +0000, Mike Kelly <pioto@pioto.org> wrote:
> For starters, if I'm simply trying to retrieve a single message, the
> interface is rather awkard. I seem to need to do something like:
> 
>     my $json = `notmuch show --format=json id:$message_id`;
>     my $parsed_json = decode_json($json);
>     my $message = $parsed_json->[0][0][0];

That does seem fairly awkward, yes. Do you have a suggestion for how
you'd like the output to be structured instead?

> And, when I'm doing my search earlier to even find those message ids, I
> need to do a check to `notmuch count` first to see if I'll even get any
> results, because the 0 result case is not valid JSON.

Yikes! That's a bug in notmuch that we should get fixed rather than you
just working around it. I just started adding a test for this
case. Currently:

	notmuch search --format=json "string that matches nothing"

returns nothing. Presumably, this should return just an empty json array
instead, (that is, "[]")?

-Carl

-- 
carl.d.worth@intel.com
part-000.sig (application/pgp-signature)

Thread: