unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Edmondson <dme@dme.org>
To: Edgar Hipp <contact@javascript-ninja.fr>, notmuch@notmuchmail.org
Subject: Re: Show email adress in output of `notmuch search --format json`
Date: Thu, 01 Jun 2017 10:41:02 +0100	[thread overview]
Message-ID: <m2lgpcjb9t.fsf@dme.org> (raw)
In-Reply-To: <20170601065917.tb7enmxklevslevt@fr-fadpc15.europe.altair.com>

On Thursday, 2017-06-01 at 08:59:17 +0200, Edgar Hipp wrote:

> Hello !
>
> I'm building a tool that combines fzf (a fuzzy finder) and notmuch to
> find email more interactively.
>
> For that, it would be great if the --format=json would return not just
> the author name, but also the author email.
>
> I run : 
>
> ```
> notmuch search  --format=json '*' | tail -1
> ```
>
> And get following output : 
>
> ```
> {"thread": "0000000000000b72", "timestamp": 1397639242, "date_relative": "2014-04-16", "matched": 1, "total": 1, "authors": "-a l'attention de contact-", "subject": "[SPAM] Lettre d'information", "query": ["id:SKT8635X-JCWL-FS8M-IDH7-WTK8XFCLCQ@idealcoursier.com", null], "tags": ["inbox"]}]
> ```
>
> I would like to get the real email adress too : 
>
> ```
> {"thread": "0000000000000b72", "timestamp": 1397639242, "date_relative": "2014-04-16", "matched": 1, "total": 1, "authoremail": "contact@idealcoursier.com", "authors": "-a l'attention de contact-", "subject": "[SPAM] Lettre d'information", "query": ["id:SKT8635X-JCWL-FS8M-IDH7-WTK8XFCLCQ@idealcoursier.com", null], "tags": ["inbox"]}]
> ```
>
> More generally, it would be great to have a configuration option to
> specify which fields you want, like how `git log --format=` works.
>
> What do you think ?

You're using the output of “search”:

% notmuch search --format=json id:20170601065917.tb7enmxklevslevt@fr-fadpc15.europe.altair.com
[{"thread": "0000000000037667", "timestamp": 1496300357, "date_relative": "Today 07:59", "matched": 1, "total": 1, "authors": "Edgar Hipp", "subject": "Show email adress in output of `notmuch search --format json`", "query": ["id:20170601065917.tb7enmxklevslevt@fr-fadpc15.europe.altair.com", null], "tags": ["inbox4", "list", "notmuch"]}]

Perhaps the output of “show” is more what you're after?

% notmuch show --format=json id:20170601065917.tb7enmxklevslevt@fr-fadpc15.europe.altair.com
[[[{"id": "20170601065917.tb7enmxklevslevt@fr-fadpc15.europe.altair.com", "match": true, "excluded": false, "filename": "/home/dme/Maildir/.d.list.notmuch/cur/1496309415_0.21047.disaster-area,U=12312,FMD5=48696af6d61a012532c1ce55c0592d76:2,S", "timestamp": 1496300357, "date_relative": "Today 07:59", "tags": ["inbox4", "list", "notmuch"], "headers": {"Subject": "Show email adress in output of `notmuch search --format json`", "From": "Edgar Hipp <contact@javascript-ninja.fr>", "To": "notmuch@notmuchmail.org", "Date": "Thu, 01 Jun 2017 08:59:17 +0200"}, "body": [{"id": 1, "content-type": "text/plain", "content": "Hello !\n\nI'm building a tool that combines fzf (a fuzzy finder) and notmuch to\nfind email more interactively.\n\nFor that, it would be great if the --format=json would return not just\nthe author name, but also the author email.\n\nI run : \n\n```\nnotmuch search  --format=json '*' | tail -1\n```\n\nAnd get following output : \n\n```\n{\"thread\": \"0000000000000b72\", \"timestamp\": 1397639242, \"date_relative\": \"2014-04-16\", \"matched\": 1, \"total\": 1, \"authors\": \"-a l'attention de contact-\", \"subject\": \"[SPAM] Lettre d'information\", \"query\": [\"id:SKT8635X-JCWL-FS8M-IDH7-WTK8XFCLCQ@idealcoursier.com\", null], \"tags\": [\"inbox\"]}]\n```\n\nI would like to get the real email adress too : \n\n```\n{\"thread\": \"0000000000000b72\", \"timestamp\": 1397639242, \"date_relative\": \"2014-04-16\", \"matched\": 1, \"total\": 1, \"authoremail\": \"contact@idealcoursier.com\", \"authors\": \"-a l'attention de contact-\", \"subject\": \"[SPAM] Lettre d'information\", \"query\": [\"id:SKT8635X-JCWL-FS8M-IDH7-WTK8XFCLCQ@idealcoursier.com\", null], \"tags\": [\"inbox\"]}]\n```\n\nMore generally, it would be great to have a configuration option to\nspecify which fields you want, like how `git log --format=` works.\n\nWhat do you think ?\n\nBest,\n\nEdgar\n\n_______________________________________________\nnotmuch mailing list\nnotmuch@notmuchmail.org\nhttps://notmuchmail.org/mailman/listinfo/notmuch\n"}]}, []]]]
% 

The “search” output is meant purely for displaying a list of threads, so
the information presented is limited to whatever was considered
necessary for that.

dme.
-- 
And the sign said long haired freaky people need not apply.

  reply	other threads:[~2017-06-01  9:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01  6:59 Show email adress in output of `notmuch search --format json` Edgar Hipp
2017-06-01  9:41 ` David Edmondson [this message]
2017-06-02  8:35   ` Edgar Hipp
2017-06-02  9:08     ` David Edmondson
2017-06-02  9:28       ` Edgar Hipp
2017-06-02  9:30         ` Edgar Hipp
2017-06-02 10:11         ` David Edmondson
  -- strict thread matches above, loose matches on Subject: below --
2017-06-02 10:40 Edgar Hipp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2lgpcjb9t.fsf@dme.org \
    --to=dme@dme.org \
    --cc=contact@javascript-ninja.fr \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).