unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org
Subject: [PATCH 3/5] CLI: add print_status_database
Date: Sat, 23 Jan 2016 10:59:56 -0400	[thread overview]
Message-ID: <1453561198-2893-4-git-send-email-david@tethera.net> (raw)
In-Reply-To: <1453561198-2893-1-git-send-email-david@tethera.net>

This could probably be used at quite a few places in the existing code,
but in the immediate future I plan to use in some new code in
notmuch-dump
---
 notmuch-client.h |  5 +++++
 status.c         | 17 +++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/notmuch-client.h b/notmuch-client.h
index 3bd2903..7c9a1ea 100644
--- a/notmuch-client.h
+++ b/notmuch-client.h
@@ -459,6 +459,11 @@ print_status_query (const char *loc,
 		    const notmuch_query_t *query,
 		    notmuch_status_t status);
 
+notmuch_status_t
+print_status_database (const char *loc,
+		       const notmuch_database_t *database,
+		       notmuch_status_t status);
+
 #include "command-line-arguments.h"
 
 extern char *notmuch_requested_db_uuid;
diff --git a/status.c b/status.c
index 8fa81cb..45d3fb4 100644
--- a/status.c
+++ b/status.c
@@ -19,3 +19,20 @@ print_status_query (const char *loc,
     }
     return status;
 }
+
+notmuch_status_t
+print_status_database (const char *loc,
+		    const notmuch_database_t *notmuch,
+		    notmuch_status_t status)
+{
+    if (status) {
+	const char *msg;
+
+	fprintf (stderr, "%s: %s\n", loc,
+		 notmuch_status_to_string (status));
+	msg = notmuch_database_status_string (notmuch);
+	if (msg)
+	    fputs (msg, stderr);
+    }
+    return status;
+}
-- 
2.6.4

  parent reply	other threads:[~2016-01-23 15:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-23 14:59 library config API David Bremner
2016-01-23 14:59 ` [PATCH 1/5] lib: provide " David Bremner
2016-01-23 14:59 ` [PATCH 2/5] lib: config list iterators David Bremner
2016-01-23 14:59 ` David Bremner [this message]
2016-01-23 14:59 ` [PATCH 4/5] CLI: add optional config data to dump output David Bremner
2016-01-23 14:59 ` [PATCH 5/5] CLI: optionally restore config data David Bremner
2016-03-12 12:31 ` library config api v4 David Bremner
2016-03-12 12:31   ` [PATCH 1/6] lib: provide config API David Bremner
2016-03-12 12:31   ` [PATCH 2/6] lib: config list iterators David Bremner
2016-03-12 12:31   ` [PATCH 3/6] CLI: add print_status_database David Bremner
2016-03-12 12:31   ` [PATCH 4/6] CLI: add optional config data to dump output David Bremner
2016-03-12 12:31   ` [PATCH 5/6] CLI: optionally restore config data David Bremner
2016-03-12 12:31   ` [PATCH 6/6] WIP: support XDG database directory David Bremner
2016-03-14 18:06     ` Tomi Ollila
2016-03-19 20:19       ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1453561198-2893-4-git-send-email-david@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).