cli: add print_status_message()

This function is a parallel to print_status_query() or
print_status_database().  Thanks to David Bremner for the suggestion!
This commit is contained in:
Daniel Kahn Gillmor 2018-05-11 02:57:55 -04:00 committed by David Bremner
parent 6a9f26b4a0
commit f32e52448b
2 changed files with 25 additions and 0 deletions

View file

@ -481,6 +481,11 @@ print_status_query (const char *loc,
const notmuch_query_t *query, const notmuch_query_t *query,
notmuch_status_t status); notmuch_status_t status);
notmuch_status_t
print_status_message (const char *loc,
const notmuch_message_t *message,
notmuch_status_t status);
notmuch_status_t notmuch_status_t
print_status_database (const char *loc, print_status_database (const char *loc,
const notmuch_database_t *database, const notmuch_database_t *database,

View file

@ -20,6 +20,26 @@ print_status_query (const char *loc,
return status; return status;
} }
notmuch_status_t
print_status_message (const char *loc,
const notmuch_message_t *message,
notmuch_status_t status)
{
if (status) {
const char *msg;
notmuch_database_t *notmuch;
fprintf (stderr, "%s: %s\n", loc,
notmuch_status_to_string (status));
notmuch = notmuch_message_get_database (message);
msg = notmuch_database_status_string (notmuch);
if (msg)
fputs (msg, stderr);
}
return status;
}
notmuch_status_t notmuch_status_t
print_status_database (const char *loc, print_status_database (const char *loc,
const notmuch_database_t *notmuch, const notmuch_database_t *notmuch,