return
;;
--output)
- COMPREPLY=( $( compgen -W "sender recipients count" -- "${cur}" ) )
+ COMPREPLY=( $( compgen -W "sender recipients count address" -- "${cur}" ) )
return
;;
--sort)
intended for programs that invoke **notmuch(1)** internally. If
omitted, the latest supported version will be used.
- ``--output=(sender|recipients|count)``
+ ``--output=(sender|recipients|count|address)``
Controls which information appears in the output. This option
can be given multiple times to combine different outputs.
Note: With this option, addresses are printed only after
the whole search is finished. This may take long time.
+ **address**
+ Output only the email addresses instead of the full
+ mailboxes with names and email addresses. This option has
+ no effect on the JSON or S-Expression output formats.
+
``--deduplicate=(no|mailbox|address)``
Control the deduplication of results.
OUTPUT_SENDER = 1 << 5,
OUTPUT_RECIPIENTS = 1 << 6,
OUTPUT_COUNT = 1 << 7,
+ OUTPUT_ADDRESS = 1 << 8,
} output_t;
typedef enum {
format->integer (format, count);
format->string (format, "\t");
}
- format->string (format, name_addr);
+ if (ctx->output & OUTPUT_ADDRESS)
+ format->string (format, addr);
+ else
+ format->string (format, name_addr);
format->separator (format);
} else {
format->begin_map (format);
(notmuch_keyword_t []){ { "sender", OUTPUT_SENDER },
{ "recipients", OUTPUT_RECIPIENTS },
{ "count", OUTPUT_COUNT },
+ { "address", OUTPUT_ADDRESS },
{ 0, 0 } } },
{ .opt_keyword = &ctx->exclude, .name = "exclude", .keywords =
(notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },
EOF
test_expect_equal_file EXPECTED OUTPUT
+test_begin_subtest "--output=recipients --output=address"
+notmuch address --output=recipients --output=address '*' >OUTPUT
+cat <<EOF >EXPECTED
+allan@archlinux.org
+aur-general@archlinux.org
+olivier.berger@it-sudparis.eu
+notmuch@notmuchmail.org
+notmuch@notmuchmail.org
+keithp@keithp.com
+dottedmag@dottedmag.net
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "--output=sender --output=address --output=count"
+notmuch address --output=sender --output=address --output=count '*' | sort -n >OUTPUT
+cat <<EOF >EXPECTED
+1 agriffis@n01se.net
+1 aperez@igalia.com
+1 boulogne.f@gmail.com
+1 chris@chris-wilson.co.uk
+1 ingmar@exherbo.org
+1 isra@herraiz.org
+1 olivier.berger@it-sudparis.eu
+1 rollandsantimano@yahoo.com
+2 alex.boterolowry@gmail.com
+2 gzjjgod@gmail.com
+3 stewart@flamingspork.com
+4 alex.boterolowry@gmail.com
+4 jan@ryngle.com
+5 dottedmag@dottedmag.net
+5 lars@seas.harvard.edu
+7 keithp@keithp.com
+12 cworth@cworth.org
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
test_begin_subtest "--output=count --format=json"
# Since the iteration order of GHashTable is not specified, we
# preprocess and sort the results to keep the order stable here.