1 Return-Path: <too@guru-group.fi>
\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 16189431FC0
\r
6 for <notmuch@notmuchmail.org>; Thu, 6 Nov 2014 10:13:10 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 8KC06lWcnyAm for <notmuch@notmuchmail.org>;
\r
16 Thu, 6 Nov 2014 10:12:29 -0800 (PST)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 423FE431FBD
\r
19 for <notmuch@notmuchmail.org>; Thu, 6 Nov 2014 10:12:29 -0800 (PST)
\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)
\r
21 id 643B810008E; Thu, 6 Nov 2014 20:11:58 +0200 (EET)
\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
23 To: notmuch@notmuchmail.org
\r
24 Subject: [PATCH] cli: notmuch address option defaults update
\r
25 Date: Thu, 6 Nov 2014 20:11:56 +0200
\r
26 Message-Id: <1415297516-29203-1-git-send-email-tomi.ollila@iki.fi>
\r
27 X-Mailer: git-send-email 2.0.0
\r
28 Cc: tomi.ollila@iki.fi
\r
29 X-BeenThere: notmuch@notmuchmail.org
\r
30 X-Mailman-Version: 2.1.13
\r
32 List-Id: "Use and development of the notmuch mail system."
\r
33 <notmuch.notmuchmail.org>
\r
34 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
35 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
36 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
37 List-Post: <mailto:notmuch@notmuchmail.org>
\r
38 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
39 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
40 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
41 X-List-Received-Date: Thu, 06 Nov 2014 18:13:10 -0000
\r
43 When no --output option were given, change default to display senders
\r
44 only. This is faster and provides useful-enough list of addresses.
\r
46 When only --count option is given, display senders (in contrary to not
\r
47 displaying anything).
\r
49 Document how --count affects to "sort order" a bit more accurately.
\r
51 Clean up some whitespace in the documentation.
\r
53 One test updated to have --output=count without sender nor recipient
\r
57 Some quick updates to the notmuch address interface which I hope will
\r
58 be considered to be included in 0.19 release. As we are in feature freeze
\r
59 I hope this gets quick feedback, in any way you desire.
\r
63 doc/man1/notmuch-address.rst | 34 ++++++++++++++++++----------------
\r
64 notmuch-search.c | 4 ++--
\r
65 test/T095-address.sh | 14 +++++++-------
\r
66 3 files changed, 27 insertions(+), 25 deletions(-)
\r
68 diff --git a/doc/man1/notmuch-address.rst b/doc/man1/notmuch-address.rst
\r
69 index 359616e0dc5f..034607c434d2 100644
\r
70 --- a/doc/man1/notmuch-address.rst
\r
71 +++ b/doc/man1/notmuch-address.rst
\r
72 @@ -32,28 +32,28 @@ Supported options for **address** include
\r
73 ``--output=(sender|recipients|count)``
\r
75 Controls which information appears in the output. This option
\r
76 - can be given multiple times to combine different outputs.
\r
77 - Omitting this option is equivalent to
\r
78 - --output=sender --output=recipients.
\r
79 + can be given multiple times to combine different outputs.
\r
80 + Omitting this option is equivalent to --output=sender.
\r
84 Output all addresses from the *From* header.
\r
86 - Note: Searching for **sender** should be much faster than
\r
87 - searching for **recipients**, because sender addresses are
\r
88 - cached directly in the database whereas other addresses
\r
89 - need to be fetched from message files.
\r
90 + Note: Searching for **sender** should be much faster than
\r
91 + searching for **recipients**, because sender addresses are
\r
92 + cached directly in the database whereas other addresses
\r
93 + need to be fetched from message files.
\r
97 Output all addresses from the *To*, *Cc* and *Bcc*
\r
101 - Print the count of how many times was the address
\r
102 - encountered during search.
\r
104 + Print the count of how many times was the address
\r
105 + encountered during search.
\r
107 - Note: With this option, addresses are printed only after
\r
108 - the whole search is finished. This may take long time.
\r
109 + Note: With this option, addresses are printed only after
\r
110 + the whole search is finished (and in seemingly random
\r
111 + order). This may take long time.
\r
113 ``--sort=``\ (**newest-first**\ \|\ **oldest-first**)
\r
114 This option can be used to present results in either
\r
115 @@ -63,7 +63,9 @@ Supported options for **address** include
\r
116 By default, results will be displayed in reverse chronological
\r
117 order, (that is, the newest results will be displayed first).
\r
119 - This option has no effect when used with --output=count.
\r
120 + This option affects the seemingly random output order when
\r
121 + used with --output=count.
\r
124 ``--exclude=(true|false)``
\r
125 A message is called "excluded" if it matches at least one tag in
\r
126 @@ -95,4 +97,4 @@ SEE ALSO
\r
127 **notmuch-dump(1)**, **notmuch-hooks(5)**, **notmuch-insert(1)**,
\r
128 **notmuch-new(1)**, **notmuch-reply(1)**, **notmuch-restore(1)**,
\r
129 **notmuch-search-terms(7)**, **notmuch-show(1)**, **notmuch-tag(1)**,
\r
130 -***notmuch-search(1)**
\r
131 +**notmuch-search(1)**
\r
132 diff --git a/notmuch-search.c b/notmuch-search.c
\r
133 index 5036d8e44005..14b9f01c5ad1 100644
\r
134 --- a/notmuch-search.c
\r
135 +++ b/notmuch-search.c
\r
136 @@ -735,8 +735,8 @@ notmuch_address_command (notmuch_config_t *config, int argc, char *argv[])
\r
138 return EXIT_FAILURE;
\r
140 - if (! ctx->output)
\r
141 - ctx->output = OUTPUT_SENDER | OUTPUT_RECIPIENTS;
\r
142 + if (! (ctx->output & (OUTPUT_SENDER | OUTPUT_RECIPIENTS)))
\r
143 + ctx->output |= OUTPUT_SENDER;
\r
145 if (_notmuch_search_prepare (ctx, config,
\r
146 argc - opt_index, argv + opt_index))
\r
147 diff --git a/test/T095-address.sh b/test/T095-address.sh
\r
148 index 033d0f4fd68c..ed0cac7807ff 100755
\r
149 --- a/test/T095-address.sh
\r
150 +++ b/test/T095-address.sh
\r
151 @@ -27,6 +27,11 @@ Mikhail Gusarov <dottedmag@dottedmag.net>
\r
153 test_expect_equal_file OUTPUT EXPECTED
\r
155 +test_begin_subtest "without --output"
\r
156 +notmuch address '*' >OUTPUT
\r
157 +# Use EXPECTED from previous subtest
\r
158 +test_expect_equal_file OUTPUT EXPECTED
\r
160 test_begin_subtest "--output=sender --format=json"
\r
161 notmuch address --output=sender --format=json '*' >OUTPUT
\r
162 cat <<EOF >EXPECTED
\r
163 @@ -91,11 +96,6 @@ Mikhail Gusarov <dottedmag@dottedmag.net>
\r
165 test_expect_equal_file OUTPUT EXPECTED
\r
167 -test_begin_subtest "without --output"
\r
168 -notmuch address '*' >OUTPUT
\r
169 -# Use EXPECTED from previous subtest
\r
170 -test_expect_equal_file OUTPUT EXPECTED
\r
172 test_begin_subtest "--output=sender --output=count"
\r
173 notmuch address --output=sender --output=count '*' | sort -n >OUTPUT
\r
174 cat <<EOF >EXPECTED
\r
175 @@ -119,10 +119,10 @@ cat <<EOF >EXPECTED
\r
177 test_expect_equal_file OUTPUT EXPECTED
\r
179 -test_begin_subtest "--output=sender --output=count --format=json"
\r
180 +test_begin_subtest "--output=count --format=json"
\r
181 # Since the iteration order of GHashTable is not specified, we
\r
182 # preprocess and sort the results to keep the order stable here.
\r
183 -notmuch address --output=sender --output=count --format=json '*' | \
\r
184 +notmuch address --output=count --format=json '*' | \
\r
185 sed -e 's/^\[//' -e 's/]$//' -e 's/,$//' | sort >OUTPUT
\r
186 cat <<EOF >EXPECTED
\r
187 {"name": "Adrian Perez de Castro", "address": "aperez@igalia.com", "name-addr": "Adrian Perez de Castro <aperez@igalia.com>", "count": 1}
\r