unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* About the json output and the number of results shown.
@ 2011-01-12 18:37 Christophe-Marie Duquesne
  2011-01-12 22:39 ` Mike Kelly
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Christophe-Marie Duquesne @ 2011-01-12 18:37 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-02-13  6:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-12 18:37 About the json output and the number of results shown Christophe-Marie Duquesne
2011-01-12 22:39 ` Mike Kelly
2011-01-28 20:44   ` Carl Worth
2011-01-29 15:59     ` Mike Kelly
2011-01-13 10:34 ` Sebastian Spaeth
2011-01-13 18:46   ` Christophe-Marie Duquesne
2011-01-14 13:48     ` Sebastian Spaeth
2011-01-28 20:27     ` Carl Worth
2011-01-28 20:40 ` Carl Worth
2011-02-13  6:29   ` Jeff Waugh

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).