From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 4A8B442D2BA for ; Wed, 12 Jan 2011 10:37:45 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled 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 rU-gHb6+ifwD for ; Wed, 12 Jan 2011 10:37:44 -0800 (PST) Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com [74.125.82.181]) by olra.theworths.org (Postfix) with ESMTP id 67F5842D2B1 for ; Wed, 12 Jan 2011 10:37:44 -0800 (PST) Received: by wyf22 with SMTP id 22so907838wyf.26 for ; Wed, 12 Jan 2011 10:37:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=xlFdPLszRtZW/C2C2VYaoylLAFVeNGpv41toBTNzwVg=; b=BAYLl0izFsL5PoErUGfiJ3PtpGzn/2nUXjweJAI880SwlK4sg87l3jjF+4bO8W3Tcw Ub/FceO5Iht+BQHXGqw8anKt5P/pY0m3jaD13TdZP+oYHsqEi0hkDg5zuPSx/GqnPFA5 uIXrI4PPEBPX5Hsoi89tD8Wd3vUYQL+PG2vhg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=drVYhvCuvMeByl5lyUd6D+WMOp9GxogGyzvAqBdKVIaRxTGvbDKQ51BNg5GNDQ4onc i5xpLL+At7NLq8iV76v3p0dAO5iaaA6qrFn29lGXTBQnE50cXoSKUrDmG+/whK8Ux0DR pZW4M9QbjG/k6+I+v43LnhoUKdVksaf6BuRRo= Received: by 10.227.146.195 with SMTP id i3mr1391952wbv.67.1294857461961; Wed, 12 Jan 2011 10:37:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.227.143.206 with HTTP; Wed, 12 Jan 2011 10:37:21 -0800 (PST) From: Christophe-Marie Duquesne Date: Wed, 12 Jan 2011 19:37:21 +0100 Message-ID: Subject: About the json output and the number of results shown. To: notmuch@notmuchmail.org Content-Type: text/plain; charset=UTF-8 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: Wed, 12 Jan 2011 18:37:45 -0000 Hi, The notmuch command line tool has an option that seems very interesting to me: --output=json In several languages, and especially in python, json is as easy to parse as: >>> res = json.load(stream) If your stream contains valid json, you then get all your data in res and you can immediately use it. With notmuch, some commands can bring a lot of results, and can take some time to return. That is why when I began to write a curse interface to notmuch, I added a mechanism to spawn these commands in background and gather the results asynchronously. Sadly, this makes me unable to use the built-in python json parser: As long as the output has not finished, the data on the stream is not valid json since it lacks at least the closing bracket '}'. As a consequence, I find easier not to use json and parse the data as it arrives. So I am wondering: what is the point of having a tool that is able to output json and ending in not using it? Is there a solution to make the json output more useable? One solution I've been thinking about would be to add an option: the range of results to show (something like --range=25:50). Is it doable easily? I mean: if results are not guaranteed to be in a given order, that would obviously be an issue. Same if finding the results 25:50 is exactly as long as finding the results 1:50. Otherwise, if it is doable, I guess this mail is a feature request. In any case, do you have any proposal for making sense of this json output without modifications in the notmuch CLI? Cheers, Christophe-Marie Duquesne