Yet another thing that will be extremely handy for scripts.
OUTPUT_SUMMARY,
OUTPUT_THREADS,
OUTPUT_MESSAGES,
OUTPUT_SUMMARY,
OUTPUT_THREADS,
OUTPUT_MESSAGES,
static int
do_search_messages (const void *ctx,
const search_format_t *format,
static int
do_search_messages (const void *ctx,
const search_format_t *format,
- notmuch_query_t *query)
+ notmuch_query_t *query,
+ output_t output)
{
notmuch_message_t *message;
notmuch_messages_t *messages;
{
notmuch_message_t *message;
notmuch_messages_t *messages;
if (! first_message)
fputs (format->item_sep, stdout);
if (! first_message)
fputs (format->item_sep, stdout);
- format->item_id (ctx, "id:", notmuch_message_get_message_id (message));
+ if (output == OUTPUT_FILES) {
+ format->item_id (ctx, "",
+ notmuch_message_get_filename (message));
+ } else { /* output == OUTPUT_MESSAGES */
+ format->item_id (ctx, "id:",
+ notmuch_message_get_message_id (message));
+ }
output = OUTPUT_THREADS;
} else if (strcmp (opt, "messages") == 0) {
output = OUTPUT_MESSAGES;
output = OUTPUT_THREADS;
} else if (strcmp (opt, "messages") == 0) {
output = OUTPUT_MESSAGES;
+ } else if (strcmp (opt, "files") == 0) {
+ output = OUTPUT_FILES;
} else if (strcmp (opt, "tags") == 0) {
output = OUTPUT_TAGS;
} else {
} else if (strcmp (opt, "tags") == 0) {
output = OUTPUT_TAGS;
} else {
ret = do_search_threads (ctx, format, query, sort, output);
break;
case OUTPUT_MESSAGES:
ret = do_search_threads (ctx, format, query, sort, output);
break;
case OUTPUT_MESSAGES:
- ret = do_search_messages (ctx, format, query);
+ case OUTPUT_FILES:
+ ret = do_search_messages (ctx, format, query, output);
break;
case OUTPUT_TAGS:
ret = do_search_tags (ctx, notmuch, format, query);
break;
case OUTPUT_TAGS:
ret = do_search_tags (ctx, notmuch, format, query);
+.B files
+
+Output the filenames of all messages matching the search terms, either
+one per line (--format=text) or as a JSON array (--format=json).
+.RE
+.RS 4
+.TP 4
.B tags
Output all tags that appear on any message matching the search terms,
.B tags
Output all tags that appear on any message matching the search terms,
"\t\tterms, either one per line (--format=text) or as a JSON array\n"
"\t\t(--format=json).\n"
"\n"
"\t\tterms, either one per line (--format=text) or as a JSON array\n"
"\t\t(--format=json).\n"
"\n"
+ "\t\tfiles\n"
+ "\n"
+ "\t\tOutput the filenames of all messages matching the search\n"
+ "\t\tterms, either one per line (--format=text) or as a JSON array\n"
+ "\t\t(--format=json).\n"
+ "\n"
"\t\ttags\n"
"\n"
"\t\tOutput all tags that appear on any message matching the search\n"
"\t\ttags\n"
"\n"
"\t\tOutput all tags that appear on any message matching the search\n"