Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 6C26D431FBF for ; Tue, 23 Feb 2010 11:56:13 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -3.254 X-Spam-Level: X-Spam-Status: No, score=-3.254 tagged_above=-999 required=5 tests=[ALL_TRUSTED=-1.8, AWL=1.145, BAYES_00=-2.599] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rghDn-3eeMpK; Tue, 23 Feb 2010 11:56:12 -0800 (PST) Received: from yoom.home.cworth.org (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 9D3AE431FAE; Tue, 23 Feb 2010 11:56:12 -0800 (PST) Received: by yoom.home.cworth.org (Postfix, from userid 1000) id E47D025427B; Tue, 23 Feb 2010 11:56:10 -0800 (PST) From: Carl Worth To: david@tethera.net, notmuch@notmuchmail.org In-Reply-To: <1261141195-5469-1-git-send-email-david@tethera.net> References: <1261114167-sup-8228@lisa> <1261141195-5469-1-git-send-email-david@tethera.net> Date: Tue, 23 Feb 2010 11:56:10 -0800 Message-ID: <878wajwwth.fsf@yoom.home.cworth.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Subject: Re: [notmuch] [PATCH] Add an "--output=(json|text|)" command-line option to both notmuch-search and notmuch-show. X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2010 19:56:13 -0000 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Fri, 18 Dec 2009 08:59:55 -0400, david@tethera.net wrote: > From: Scott Robinson Hi Scott (and David), I'm finally getting around to looking closely at the JSON patches (hurrah!). Here are some comments: > In the case of notmuch-show, "--output=3Djson" also implies > "--entire-thread" as the thread structure is implicit in the emitted > document tree. I think we've all agreed to use --output for selecting what to print and to instead use --format for how to format it. I also think David's got a patch to change that, but if we have to change the current patch anyway, we might change that at the same time. > --- /dev/null > +++ b/json.c > @@ -0,0 +1,73 @@ > +/* notmuch - Not much of an email program, (just index and search) > + * > + * Copyright =C2=A9 2009 Carl Worth > + * Copyright =C2=A9 2009 Keith Packard I know I didn't contribute any code to this file, so my name shouldn't be here. Scott, I imagine you have made some non-trivial contributions so your name (or suitable copyright-claiming entity) should be here. > + * Authors: Carl Worth > + * Keith Packard Same thing here. > +/* > + * json_quote_str derived from cJSON's print_string_ptr, > + * Copyright (c) 2009 Dave Gamble > + */ Thanks for attributing the source here, but let's please keep all the copyright statements up at the top of the file. It would still be reasonable to have a comment at this point that this particular code came from Dave Gamble and cJSON. But it should also mention the license under which the code is being integrated. I suggest leaving the notmuch-standar GPLv3+ blurb at the top of the file, but then quoting the license itself of the external code, (it's a short MIT-style license, right?). > +char * > +json_quote_str(const void *ctx, const char *str) It would be nice to have a little comment here describing what the function does, (what characters get quoted and how, that the return value is talloced with 'ctx' as a parent, and perhaps a pointer to the appropriate JSON reference/specification). But I definitely like this nice little function as opposed to some JSON library. Thanks! > +typedef struct search_format { > + const char *results_start; > + const char *thread_start; > + void (*thread) (const void *ctx, > + const char *id, > + const time_t date, > + const int matched, > + const int total, > + const char *authors, > + const char *subject); ... Definitely missing at least a quick comment for internal documentation here as well. But I do like the way this works. > --- a/notmuch.c > +++ b/notmuch.c > @@ -162,6 +162,11 @@ command_t commands[] =3D { > "\n" > "\t\tSupported options for search include:\n" > "\n" > + "\t\t--output=3D(json|text)\n" > + "\n" > + "\t\t\tPresents the results in either JSON or plain-text\n" > + "\t\t\tformat, which is the default.\n" > + "\n" Thanks for adding the documentation here. But please add to notmuch.1 as well. This all looks really great. And I can't wait to apply it and play with it more. =2DCarl --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iD8DBQFLhDLa6JDdNq8qSWgRArdUAJ932a5kxn2n91gFuSB8batyaoWnAwCeJirW Cj+6sjGiw9F1zGV9hEd9+UA= =imco -----END PGP SIGNATURE----- --=-=-=--