[PATCH v2 08/11] notmuch-search: output total_filesize thread result
Ioan-Adrian Ratiu
adi at adirat.com
Thu May 18 15:27:05 PDT 2017
This works for all the search output formats (sexp, json, text).
Signed-off-by: Ioan-Adrian Ratiu <adi at adirat.com>
---
devel/schemata | 1 +
notmuch-search.c | 6 +++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/devel/schemata b/devel/schemata
index 00ebb7a6..c9e05623 100644
--- a/devel/schemata
+++ b/devel/schemata
@@ -153,6 +153,7 @@ search_tags = [string*]
thread_summary = {
thread: threadid,
+ total_filesize: unsigned long,
timestamp: unix_time,
date_relative: string, # user-friendly timestamp
matched: int, # number of matched messages
diff --git a/notmuch-search.c b/notmuch-search.c
index 65ecfaab..3cf2a65a 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -161,6 +161,7 @@ do_search_threads (search_context_t *ctx)
const char *thread_id = notmuch_thread_get_thread_id (thread);
int matched = notmuch_thread_get_matched_messages (thread);
int total = notmuch_thread_get_total_messages (thread);
+ unsigned long total_filesize = notmuch_thread_get_total_filesize (thread);
const char *relative_date = NULL;
notmuch_bool_t first_tag = TRUE;
@@ -175,8 +176,9 @@ do_search_threads (search_context_t *ctx)
if (format->is_text_printer) {
/* Special case for the text formatter */
- printf ("thread:%s %12s [%d/%d] %s; %s (",
+ printf ("thread:%s %lu %12s [%d/%d] %s; %s (",
thread_id,
+ total_filesize,
relative_date,
matched,
total,
@@ -185,6 +187,8 @@ do_search_threads (search_context_t *ctx)
} else { /* Structured Output */
format->map_key (format, "thread");
format->string (format, thread_id);
+ format->map_key (format, "total_filesize");
+ format->unsigned_long (format, total_filesize);
format->map_key (format, "timestamp");
format->integer (format, date);
format->map_key (format, "date_relative");
--
2.13.0
More information about the notmuch
mailing list