[PATCH v3 06/10] cli: Introduce "notmuch address" command
[notmuch-archives.git] / 0d / 748400a2554df6a5056a43f87f24de8f748d58
1 Return-Path: <ciprian.craciun@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 489D8429E25\r
6         for <notmuch@notmuchmail.org>; Sat, 10 Dec 2011 10:32:24 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id eyLLcz-Ivwa4 for <notmuch@notmuchmail.org>;\r
17         Sat, 10 Dec 2011 10:32:24 -0800 (PST)\r
18 Received: from mail-gx0-f181.google.com (mail-gx0-f181.google.com\r
19         [209.85.161.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id E4FE2431FB6\r
22         for <notmuch@notmuchmail.org>; Sat, 10 Dec 2011 10:32:23 -0800 (PST)\r
23 Received: by ggnr1 with SMTP id r1so5213218ggn.26\r
24         for <notmuch@notmuchmail.org>; Sat, 10 Dec 2011 10:32:22 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=mime-version:date:message-id:subject:from:to:content-type;\r
27         bh=aO31lsGX1a+4Y3rrTY0eOenUiZO02bs0mf6PJWgIQX8=;\r
28         b=IzMF/s1hUYIXDDiheFO9tqLF5H36HOc/dZ88Xtcg5gKdCNefdcgASmb4FZMzZKKB+M\r
29         CX1etm7K20CM7Y1wraPeX0Yx1WwgVe/0ZrR8uVPAMfrcZml5a4TZrVUmRwhCD5iHQrSS\r
30         VPsMwA2OlRJkZl0D4UHXLsXN6wwCz/kH2PtUQ=\r
31 MIME-Version: 1.0\r
32 Received: by 10.182.145.99 with SMTP id st3mr1527602obb.69.1323541942419; Sat,\r
33         10 Dec 2011 10:32:22 -0800 (PST)\r
34 Received: by 10.182.222.35 with HTTP; Sat, 10 Dec 2011 10:32:22 -0800 (PST)\r
35 Date: Sat, 10 Dec 2011 20:32:22 +0200\r
36 Message-ID:\r
37  <CA+Tk8fycS4kmBRABRS4vFQLb3v0-ajcLZwPOwwEf98yvObgpwA@mail.gmail.com>\r
38 Subject: Exporting a single email as JSON\r
39 From: Ciprian Dorin Craciun <ciprian.craciun@gmail.com>\r
40 To: notmuch@notmuchmail.org\r
41 Content-Type: text/plain; charset=UTF-8\r
42 X-BeenThere: notmuch@notmuchmail.org\r
43 X-Mailman-Version: 2.1.13\r
44 Precedence: list\r
45 List-Id: "Use and development of the notmuch mail system."\r
46         <notmuch.notmuchmail.org>\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
50 List-Post: <mailto:notmuch@notmuchmail.org>\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
54 X-List-Received-Date: Sat, 10 Dec 2011 18:32:24 -0000\r
55 \r
56     Hello all!\r
57 \r
58     Quick question: why isn't it reasonable to export a **single**\r
59 email in JSON format (by using the `show` sub-command)? (I mean I\r
60 understand that in order to be able to correctly parse the output we\r
61 need only one "object" (i.e. a list of threads, containing a list of\r
62 emails, etc.). But there might be use cases in which we need a\r
63 "twist".)\r
64 \r
65     My current use case is: I want to import the JSON representation\r
66 of my emails in CouchDB, each email in a single document. And as I\r
67 already have my emails indexed with Notmuch, I hopped that -- with the\r
68 help of some Bash-fu and Curl -- it would have been trivial to\r
69 instruct notmuch to export all emails matching a certain criteria as\r
70 JSON...\r
71 \r
72     What would have been perfect in this case: each matching email\r
73 (with or without the `--entire-thread` flag) should be exported as a\r
74 single JSON object on a single line, thus each different email on a\r
75 single line. Thus I could have easily used `notmuch show\r
76 --output=json-line -- {criteria} | xargs -L 1 -- curl\r
77 {couchdb-magic}`.)\r
78 \r
79     For now I'll pre-process the current output in JavaScript.\r
80 \r
81     Thanks,\r
82     Ciprian.\r