1 Return-Path: <sojka@merica.cz>
\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 0F76C431FDA
\r
6 for <notmuch@notmuchmail.org>; Tue, 4 Nov 2014 14:16:03 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id ecCJSks81sz8 for <notmuch@notmuchmail.org>;
\r
16 Tue, 4 Nov 2014 14:15:54 -0800 (PST)
\r
17 Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 82801429E44
\r
19 for <notmuch@notmuchmail.org>; Tue, 4 Nov 2014 14:15:48 -0800 (PST)
\r
20 Received: from localhost (unknown [192.168.200.7])
\r
21 by max.feld.cvut.cz (Postfix) with ESMTP id F00135CD186;
\r
22 Tue, 4 Nov 2014 23:15:47 +0100 (CET)
\r
23 X-Virus-Scanned: IMAP STYX AMAVIS
\r
24 Received: from max.feld.cvut.cz ([192.168.200.1])
\r
25 by localhost (styx.feld.cvut.cz [192.168.200.7]) (amavisd-new,
\r
27 with ESMTP id mR-zP87R8GZe; Tue, 4 Nov 2014 23:15:44 +0100 (CET)
\r
28 Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34])
\r
29 by max.feld.cvut.cz (Postfix) with ESMTP id F0DE25CD180;
\r
30 Tue, 4 Nov 2014 23:15:43 +0100 (CET)
\r
31 Received: from wsh by steelpick.2x.cz with local (Exim 4.84)
\r
32 (envelope-from <sojka@merica.cz>)
\r
33 id 1XlmO2-0006sY-97; Tue, 04 Nov 2014 23:15:38 +0100
\r
34 From: Michal Sojka <sojkam1@fel.cvut.cz>
\r
35 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org
\r
36 Subject: Re: [PATCH v2 06/10] cli: Introduce "notmuch address" command
\r
37 In-Reply-To: <87zjc72v79.fsf@qmul.ac.uk>
\r
38 References: <1415058622-21162-1-git-send-email-sojkam1@fel.cvut.cz>
\r
39 <1415058622-21162-7-git-send-email-sojkam1@fel.cvut.cz>
\r
40 <87zjc72v79.fsf@qmul.ac.uk>
\r
41 User-Agent: Notmuch/0.18.2+157~ga00d359 (http://notmuchmail.org) Emacs/24.3.1
\r
42 (x86_64-pc-linux-gnu)
\r
43 Date: Tue, 04 Nov 2014 23:15:38 +0100
\r
44 Message-ID: <87y4rqliid.fsf@steelpick.2x.cz>
\r
46 Content-Type: text/plain
\r
47 X-BeenThere: notmuch@notmuchmail.org
\r
48 X-Mailman-Version: 2.1.13
\r
50 List-Id: "Use and development of the notmuch mail system."
\r
51 <notmuch.notmuchmail.org>
\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
55 List-Post: <mailto:notmuch@notmuchmail.org>
\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
58 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
59 X-List-Received-Date: Tue, 04 Nov 2014 22:16:03 -0000
\r
61 On Tue, Nov 04 2014, Mark Walters wrote:
\r
62 > On Mon, 03 Nov 2014, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
\r
63 >> This moves address-related functionality from search command to the
\r
64 >> new address command. The implementation shares almost all code and
\r
65 >> some command line options.
\r
67 >> Options --offset and --limit were intentionally not included in the
\r
68 >> address command, because they refer to messages numbers, which users
\r
69 >> do not see in the output. This could confuse users because, for
\r
70 >> example, they could see more addresses in the output that what was
\r
71 >> specified with --limit. This functionality can be correctly
\r
72 >> reimplemented for addresses later.
\r
74 > I am not sure about this: we already have this anomaly for output=files
\r
75 > say. Also I can imagine calling notmuch address --limit=1000 ... to get
\r
76 > a bunch of recent addresses quickly and I really am wanting to look at
\r
77 > 1000 messages, not collect 1000 addresses.
\r
79 I think that one of the reasons for having the new "address" command is
\r
80 to have cleaner user interface. And including "anomalies" doesn't sound
\r
81 like a way to achieve this. I think that now you can use "date:" query
\r
82 to limit the search.
\r
84 I volunteer to implement "address --limit" properly after 0.19. This
\r
89 > Additionally, the 1000 message approach makes sense when we start
\r
90 > deduping whereas 1000 authors becomes unclear.
\r
93 >> This was inspired by a patch from Jani Nikula.
\r
95 >> completion/notmuch-completion.bash | 42 ++++++++++++++-
\r
96 >> completion/notmuch-completion.zsh | 10 +++-
\r
97 >> doc/man1/notmuch-address.rst | 99 ++++++++++++++++++++++++++++++++++++
\r
98 >> doc/man1/notmuch-search.rst | 20 +-------
\r
99 >> doc/man1/notmuch.rst | 7 +--
\r
100 >> notmuch-client.h | 3 ++
\r
101 >> notmuch-search.c | 101 +++++++++++++++++++++++++------------
\r
103 >> 8 files changed, 228 insertions(+), 56 deletions(-)
\r
104 >> create mode 100644 doc/man1/notmuch-address.rst
\r
106 >> diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash
\r
107 >> index cfbd389..94ea2d5 100644
\r
108 >> --- a/completion/notmuch-completion.bash
\r
109 >> +++ b/completion/notmuch-completion.bash
\r
110 >> @@ -294,7 +294,7 @@ _notmuch_search()
\r
114 >> - COMPREPLY=( $( compgen -W "summary threads messages files tags sender recipients" -- "${cur}" ) )
\r
115 >> + COMPREPLY=( $( compgen -W "summary threads messages files tags" -- "${cur}" ) )
\r
119 >> @@ -320,6 +320,44 @@ _notmuch_search()
\r
123 >> +_notmuch_address()
\r
125 >> + local cur prev words cword split
\r
126 >> + _init_completion -s || return
\r
129 >> + case "${prev}" in
\r
131 >> + COMPREPLY=( $( compgen -W "json sexp text text0" -- "${cur}" ) )
\r
135 >> + COMPREPLY=( $( compgen -W "sender recipients" -- "${cur}" ) )
\r
139 >> + COMPREPLY=( $( compgen -W "newest-first oldest-first" -- "${cur}" ) )
\r
143 >> + COMPREPLY=( $( compgen -W "true false flag all" -- "${cur}" ) )
\r
149 >> + case "${cur}" in
\r
151 >> + local options="--format= --output= --sort= --exclude="
\r
152 >> + compopt -o nospace
\r
153 >> + COMPREPLY=( $(compgen -W "$options" -- ${cur}) )
\r
156 >> + _notmuch_search_terms
\r
163 >> local cur prev words cword split
\r
164 >> @@ -393,7 +431,7 @@ _notmuch_tag()
\r
168 >> - local _notmuch_commands="compact config count dump help insert new reply restore search setup show tag"
\r
169 >> + local _notmuch_commands="compact config count dump help insert new reply restore search address setup show tag"
\r
170 >> local arg cur prev words cword split
\r
172 >> # require bash-completion with _init_completion
\r
173 >> diff --git a/completion/notmuch-completion.zsh b/completion/notmuch-completion.zsh
\r
174 >> index 3e52a00..c606b75 100644
\r
175 >> --- a/completion/notmuch-completion.zsh
\r
176 >> +++ b/completion/notmuch-completion.zsh
\r
177 >> @@ -10,6 +10,7 @@ _notmuch_commands()
\r
178 >> 'setup:interactively set up notmuch for first use'
\r
179 >> 'new:find and import any new message to the database'
\r
180 >> 'search:search for messages matching the search terms, display matching threads as results'
\r
181 >> + 'address:get addresses from messages matching the given search terms'
\r
182 >> 'reply:constructs a reply template for a set of messages'
\r
183 >> 'show:show all messages matching the search terms'
\r
184 >> 'tag:add or remove tags for all messages matching the search terms'
\r
185 >> @@ -53,7 +54,14 @@ _notmuch_search()
\r
186 >> '--max-threads=[display only the first x threads from the search results]:number of threads to show: ' \
\r
187 >> '--first=[omit the first x threads from the search results]:number of threads to omit: ' \
\r
188 >> '--sort=[sort results]:sorting:((newest-first\:"reverse chronological order" oldest-first\:"chronological order"))' \
\r
189 >> - '--output=[select what to output]:output:((summary threads messages files tags sender recipients))'
\r
190 >> + '--output=[select what to output]:output:((summary threads messages files tags))'
\r
193 >> +_notmuch_address()
\r
195 >> + _arguments -s : \
\r
196 >> + '--sort=[sort results]:sorting:((newest-first\:"reverse chronological order" oldest-first\:"chronological order"))' \
\r
197 >> + '--output=[select what to output]:output:((sender recipients))'
\r
201 >> diff --git a/doc/man1/notmuch-address.rst b/doc/man1/notmuch-address.rst
\r
202 >> new file mode 100644
\r
203 >> index 0000000..8109f11
\r
205 >> +++ b/doc/man1/notmuch-address.rst
\r
206 >> @@ -0,0 +1,99 @@
\r
207 >> +===============
\r
208 >> +notmuch-address
\r
209 >> +===============
\r
214 >> +**notmuch** **address** [*option* ...] <*search-term*> ...
\r
219 >> +Search for messages matching the given search terms, and display the
\r
220 >> +addresses from them.
\r
222 >> +See **notmuch-search-terms(7)** for details of the supported syntax for
\r
223 >> +<search-terms>.
\r
225 >> +Supported options for **address** include
\r
227 >> + ``--format=``\ (**json**\ \|\ **sexp**\ \|\ **text**\ \|\ **text0**)
\r
228 >> + Presents the results in either JSON, S-Expressions, newline
\r
229 >> + character separated plain-text (default), or null character
\r
230 >> + separated plain-text (compatible with **xargs(1)** -0 option
\r
231 >> + where available).
\r
233 >> + ``--format-version=N``
\r
234 >> + Use the specified structured output format version. This is
\r
235 >> + intended for programs that invoke **notmuch(1)** internally. If
\r
236 >> + omitted, the latest supported version will be used.
\r
238 >> + ``--output=(sender|recipients)``
\r
240 >> + Controls which information appears in the output. This option
\r
241 >> + can be given multiple times to combine different outputs.
\r
242 >> + Omitting this option is equivalent to
\r
243 >> + --output=sender --output=recipients.
\r
246 >> + Output all addresses from the *From* header.
\r
248 >> + Note: Searching for **sender** should be much faster than
\r
249 >> + searching for **recipients**, because sender addresses are
\r
250 >> + cached directly in the database whereas other addresses
\r
251 >> + need to be fetched from message files.
\r
253 >> + **recipients**
\r
254 >> + Output all addresses from the *To*, *Cc* and *Bcc*
\r
257 >> + ``--sort=``\ (**newest-first**\ \|\ **oldest-first**)
\r
258 >> + This option can be used to present results in either
\r
259 >> + chronological order (**oldest-first**) or reverse chronological
\r
260 >> + order (**newest-first**).
\r
262 >> + By default, results will be displayed in reverse chronological
\r
263 >> + order, (that is, the newest results will be displayed first).
\r
265 >> + ``--exclude=(true|false|all|flag)``
\r
266 >> + A message is called "excluded" if it matches at least one tag in
\r
267 >> + search.tag\_exclude that does not appear explicitly in the
\r
268 >> + search terms. This option specifies whether to omit excluded
\r
269 >> + messages in the search process.
\r
271 >> + The default value, **true**, prevents excluded messages from
\r
272 >> + matching the search terms.
\r
274 >> + **all** additionally prevents excluded messages from appearing
\r
275 >> + in displayed results, in effect behaving as though the excluded
\r
276 >> + messages do not exist.
\r
278 >> + **false** allows excluded messages to match search terms and
\r
279 >> + appear in displayed results. Excluded messages are still marked
\r
280 >> + in the relevant outputs.
\r
282 >> + **flag** only has an effect when ``--output=summary``. The
\r
283 >> + output is almost identical to **false**, but the "match count"
\r
284 >> + is the number of matching non-excluded messages in the thread,
\r
285 >> + rather than the number of matching messages.
\r
287 > The exclude text needs updating as flag makes no sense for the address
\r
297 >> +This command supports the following special exit status codes
\r
300 >> + The requested format version is too old.
\r
303 >> + The requested format version is too new.
\r
308 >> +**notmuch(1)**, **notmuch-config(1)**, **notmuch-count(1)**,
\r
309 >> +**notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-insert(1)**,
\r
310 >> +**notmuch-new(1)**, **notmuch-reply(1)**, **notmuch-restore(1)**,
\r
311 >> +**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**,
\r
312 >> +***notmuch-search(1)**
\r
313 >> diff --git a/doc/man1/notmuch-search.rst b/doc/man1/notmuch-search.rst
\r
314 >> index 8110086..65df288 100644
\r
315 >> --- a/doc/man1/notmuch-search.rst
\r
316 >> +++ b/doc/man1/notmuch-search.rst
\r
317 >> @@ -78,25 +78,8 @@ Supported options for **search** include
\r
318 >> by null characters (--format=text0), as a JSON array
\r
319 >> (--format=json), or as an S-Expression list (--format=sexp).
\r
322 >> - Output all addresses from the *From* header that appear on
\r
323 >> - any message matching the search terms, either one per line
\r
324 >> - (--format=text), separated by null characters
\r
325 >> - (--format=text0), as a JSON array (--format=json), or as
\r
326 >> - an S-Expression list (--format=sexp).
\r
328 >> - Note: Searching for **sender** should be much faster than
\r
329 >> - searching for **recipients**, because sender addresses are
\r
330 >> - cached directly in the database whereas other addresses
\r
331 >> - need to be fetched from message files.
\r
333 >> - **recipients**
\r
334 >> - Like **sender** but for addresses from *To*, *Cc* and
\r
335 >> - *Bcc* headers.
\r
337 >> This option can be given multiple times to combine different
\r
338 >> - outputs. Currently, this is only supported for **sender** and
\r
339 >> - **recipients** outputs.
\r
342 >> ``--sort=``\ (**newest-first**\ \|\ **oldest-first**)
\r
343 >> This option can be used to present results in either
\r
344 >> @@ -173,3 +156,4 @@ SEE ALSO
\r
345 >> **notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-insert(1)**,
\r
346 >> **notmuch-new(1)**, **notmuch-reply(1)**, **notmuch-restore(1)**,
\r
347 >> **notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**
\r
348 >> +***notmuch-address(1)**
\r
349 >> diff --git a/doc/man1/notmuch.rst b/doc/man1/notmuch.rst
\r
350 >> index 9710294..98590a4 100644
\r
351 >> --- a/doc/man1/notmuch.rst
\r
352 >> +++ b/doc/man1/notmuch.rst
\r
353 >> @@ -88,8 +88,8 @@ Several of the notmuch commands accept search terms with a common
\r
354 >> syntax. See **notmuch-search-terms**\ (7) for more details on the
\r
355 >> supported syntax.
\r
357 >> -The **search**, **show** and **count** commands are used to query the
\r
358 >> -email database.
\r
359 >> +The **search**, **show**, **address** and **count** commands are used
\r
360 >> +to query the email database.
\r
362 >> The **reply** command is useful for preparing a template for an email
\r
364 >> @@ -128,7 +128,8 @@ SEE ALSO
\r
365 >> **notmuch-config(1)**, **notmuch-count(1)**, **notmuch-dump(1)**,
\r
366 >> **notmuch-hooks(5)**, **notmuch-insert(1)**, **notmuch-new(1)**,
\r
367 >> **notmuch-reply(1)**, **notmuch-restore(1)**, **notmuch-search(1)**,
\r
368 >> -**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**
\r
369 >> +**notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**,
\r
370 >> +***notmuch-address(1)**
\r
372 >> The notmuch website: **http://notmuchmail.org**
\r
374 >> diff --git a/notmuch-client.h b/notmuch-client.h
\r
375 >> index e1efbe0..5e0d475 100644
\r
376 >> --- a/notmuch-client.h
\r
377 >> +++ b/notmuch-client.h
\r
378 >> @@ -199,6 +199,9 @@ int
\r
379 >> notmuch_search_command (notmuch_config_t *config, int argc, char *argv[]);
\r
382 >> +notmuch_address_command (notmuch_config_t *config, int argc, char *argv[]);
\r
385 >> notmuch_setup_command (notmuch_config_t *config, int argc, char *argv[]);
\r
388 >> diff --git a/notmuch-search.c b/notmuch-search.c
\r
389 >> index f115359..cbd84f5 100644
\r
390 >> --- a/notmuch-search.c
\r
391 >> +++ b/notmuch-search.c
\r
392 >> @@ -23,17 +23,18 @@
\r
393 >> #include "string-util.h"
\r
396 >> + /* Search command */
\r
397 >> OUTPUT_SUMMARY = 1 << 0,
\r
398 >> OUTPUT_THREADS = 1 << 1,
\r
399 >> OUTPUT_MESSAGES = 1 << 2,
\r
400 >> OUTPUT_FILES = 1 << 3,
\r
401 >> OUTPUT_TAGS = 1 << 4,
\r
403 >> + /* Address command */
\r
404 >> OUTPUT_SENDER = 1 << 5,
\r
405 >> OUTPUT_RECIPIENTS = 1 << 6,
\r
408 >> -#define OUTPUT_ADDRESS_FLAGS (OUTPUT_SENDER | OUTPUT_RECIPIENTS)
\r
411 >> NOTMUCH_FORMAT_JSON,
\r
412 >> NOTMUCH_FORMAT_TEXT,
\r
413 >> @@ -554,51 +555,55 @@ _notmuch_search_cleanup (search_context_t *ctx)
\r
414 >> talloc_free (ctx->format);
\r
417 >> +static search_context_t search_context = {
\r
418 >> + .format_sel = NOTMUCH_FORMAT_TEXT,
\r
419 >> + .exclude = NOTMUCH_EXCLUDE_TRUE,
\r
420 >> + .sort = NOTMUCH_SORT_NEWEST_FIRST,
\r
423 >> + .limit = -1, /* unlimited */
\r
427 >> +static const notmuch_opt_desc_t common_options[] = {
\r
428 >> + { NOTMUCH_OPT_KEYWORD, &search_context.sort, "sort", 's',
\r
429 >> + (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST },
\r
430 >> + { "newest-first", NOTMUCH_SORT_NEWEST_FIRST },
\r
432 >> + { NOTMUCH_OPT_KEYWORD, &search_context.format_sel, "format", 'f',
\r
433 >> + (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
\r
434 >> + { "sexp", NOTMUCH_FORMAT_SEXP },
\r
435 >> + { "text", NOTMUCH_FORMAT_TEXT },
\r
436 >> + { "text0", NOTMUCH_FORMAT_TEXT0 },
\r
438 >> + { NOTMUCH_OPT_INT, ¬much_format_version, "format-version", 0, 0 },
\r
439 >> + { NOTMUCH_OPT_KEYWORD, &search_context.exclude, "exclude", 'x',
\r
440 >> + (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },
\r
441 >> + { "false", NOTMUCH_EXCLUDE_FALSE },
\r
442 >> + { "flag", NOTMUCH_EXCLUDE_FLAG },
\r
443 >> + { "all", NOTMUCH_EXCLUDE_ALL },
\r
445 >> + { 0, 0, 0, 0, 0 }
\r
449 >> notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
\r
451 >> - search_context_t search_context = {
\r
452 >> - .format_sel = NOTMUCH_FORMAT_TEXT,
\r
453 >> - .exclude = NOTMUCH_EXCLUDE_TRUE,
\r
454 >> - .sort = NOTMUCH_SORT_NEWEST_FIRST,
\r
457 >> - .limit = -1, /* unlimited */
\r
460 >> search_context_t *ctx = &search_context;
\r
461 >> int opt_index, ret;
\r
463 >> notmuch_opt_desc_t options[] = {
\r
464 >> - { NOTMUCH_OPT_KEYWORD, &ctx->sort, "sort", 's',
\r
465 >> - (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST },
\r
466 >> - { "newest-first", NOTMUCH_SORT_NEWEST_FIRST },
\r
468 >> - { NOTMUCH_OPT_KEYWORD, &ctx->format_sel, "format", 'f',
\r
469 >> - (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
\r
470 >> - { "sexp", NOTMUCH_FORMAT_SEXP },
\r
471 >> - { "text", NOTMUCH_FORMAT_TEXT },
\r
472 >> - { "text0", NOTMUCH_FORMAT_TEXT0 },
\r
474 >> - { NOTMUCH_OPT_INT, ¬much_format_version, "format-version", 0, 0 },
\r
475 >> { NOTMUCH_OPT_KEYWORD_FLAGS, &ctx->output, "output", 'o',
\r
476 >> (notmuch_keyword_t []){ { "summary", OUTPUT_SUMMARY },
\r
477 >> { "threads", OUTPUT_THREADS },
\r
478 >> { "messages", OUTPUT_MESSAGES },
\r
479 >> - { "sender", OUTPUT_SENDER },
\r
480 >> - { "recipients", OUTPUT_RECIPIENTS },
\r
481 >> { "files", OUTPUT_FILES },
\r
482 >> { "tags", OUTPUT_TAGS },
\r
484 >> - { NOTMUCH_OPT_KEYWORD, &ctx->exclude, "exclude", 'x',
\r
485 >> - (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },
\r
486 >> - { "false", NOTMUCH_EXCLUDE_FALSE },
\r
487 >> - { "flag", NOTMUCH_EXCLUDE_FLAG },
\r
488 >> - { "all", NOTMUCH_EXCLUDE_ALL },
\r
490 >> { NOTMUCH_OPT_INT, &ctx->offset, "offset", 'O', 0 },
\r
491 >> { NOTMUCH_OPT_INT, &ctx->limit, "limit", 'L', 0 },
\r
492 >> { NOTMUCH_OPT_INT, &ctx->dupe, "duplicate", 'D', 0 },
\r
493 >> + { NOTMUCH_OPT_INHERIT, &common_options, NULL, 0, 0 },
\r
494 >> { 0, 0, 0, 0, 0 }
\r
497 >> @@ -623,8 +628,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
\r
498 >> ctx->output == OUTPUT_THREADS)
\r
499 >> ret = do_search_threads (ctx);
\r
500 >> else if (ctx->output == OUTPUT_MESSAGES ||
\r
501 >> - ctx->output == OUTPUT_FILES ||
\r
502 >> - (ctx->output & OUTPUT_ADDRESS_FLAGS && !(ctx->output & ~OUTPUT_ADDRESS_FLAGS)))
\r
503 >> + ctx->output == OUTPUT_FILES)
\r
504 >> ret = do_search_messages (ctx);
\r
505 >> else if (ctx->output == OUTPUT_TAGS)
\r
506 >> ret = do_search_tags (ctx);
\r
507 >> @@ -637,3 +641,36 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
\r
509 >> return ret ? EXIT_FAILURE : EXIT_SUCCESS;
\r
513 >> +notmuch_address_command (notmuch_config_t *config, int argc, char *argv[])
\r
515 >> + search_context_t *ctx = &search_context;
\r
516 >> + int opt_index, ret;
\r
518 >> + notmuch_opt_desc_t options[] = {
\r
519 >> + { NOTMUCH_OPT_KEYWORD_FLAGS, &ctx->output, "output", 'o',
\r
520 >> + (notmuch_keyword_t []){ { "sender", OUTPUT_SENDER },
\r
521 >> + { "recipients", OUTPUT_RECIPIENTS },
\r
523 >> + { NOTMUCH_OPT_INHERIT, &common_options, NULL, 0, 0 },
\r
524 >> + { 0, 0, 0, 0, 0 }
\r
527 >> + opt_index = parse_arguments (argc, argv, options, 1);
\r
528 >> + if (opt_index < 0)
\r
529 >> + return EXIT_FAILURE;
\r
531 >> + if (! ctx->output)
\r
532 >> + search_context.output = OUTPUT_SENDER | OUTPUT_RECIPIENTS;
\r
534 >> + if (_notmuch_search_prepare (ctx, config,
\r
535 >> + argc - opt_index, argv + opt_index))
\r
536 >> + return EXIT_FAILURE;
\r
538 >> + ret = do_search_messages (ctx);
\r
540 >> + _notmuch_search_cleanup (ctx);
\r
542 >> + return ret ? EXIT_FAILURE : EXIT_SUCCESS;
\r
544 >> diff --git a/notmuch.c b/notmuch.c
\r
545 >> index dcda039..0fac099 100644
\r
548 >> @@ -54,6 +54,8 @@ static command_t commands[] = {
\r
549 >> "Add a new message into the maildir and notmuch database." },
\r
550 >> { "search", notmuch_search_command, FALSE,
\r
551 >> "Search for messages matching the given search terms." },
\r
552 >> + { "address", notmuch_address_command, FALSE,
\r
553 >> + "Get addresses from messages matching the given search terms." },
\r
554 >> { "show", notmuch_show_command, FALSE,
\r
555 >> "Show all messages matching the search terms." },
\r
556 >> { "count", notmuch_count_command, FALSE,
\r
560 >> _______________________________________________
\r
561 >> notmuch mailing list
\r
562 >> notmuch@notmuchmail.org
\r
563 >> http://notmuchmail.org/mailman/listinfo/notmuch
\r