Default: ``gpg``.
+ **built_with.<name>**
+
+ Compile time feature <name>. Current possibilities include
+ "compact" (see **notmuch-compact(1)**)
+ and "field_processor" (see **notmuch-search-terms(7)**).
ENVIRONMENT
===========
$(dir)/message-file.c \
$(dir)/messages.c \
$(dir)/sha1.c \
+ $(dir)/built-with.c \
$(dir)/tags.c
libnotmuch_cxx_srcs = \
--- /dev/null
+/* notmuch - Not much of an email program, (just index and search)
+ *
+ * Copyright © 2016 David Bremner
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see http://www.gnu.org/licenses/ .
+ *
+ * Author: David Bremner <david@tethera.net>
+ */
+
+#include "notmuch.h"
+#include "notmuch-private.h"
+
+notmuch_bool_t
+notmuch_built_with (const char *name)
+{
+ if (STRNCMP_LITERAL (name, "compact") == 0) {
+ return HAVE_XAPIAN_COMPACT;
+ } else if (STRNCMP_LITERAL (name, "field_processor") == 0) {
+ return HAVE_XAPIAN_FIELD_PROCESSOR;
+ } else {
+ return FALSE;
+ }
+}
void
notmuch_filenames_destroy (notmuch_filenames_t *filenames);
+/**
+ * interrogate the library for compile time features
+ */
+notmuch_bool_t
+notmuch_built_with (const char *name);
/* @} */
NOTMUCH_END_DECLS
return 0;
}
+#define BUILT_WITH_PREFIX "built_with."
+
static int
notmuch_config_command_get (notmuch_config_t *config, char *item)
{
tags = notmuch_config_get_new_tags (config, &length);
for (i = 0; i < length; i++)
printf ("%s\n", tags[i]);
+ } else if (STRNCMP_LITERAL (item, BUILT_WITH_PREFIX) == 0) {
+ printf ("%s\n",
+ notmuch_built_with (item + strlen (BUILT_WITH_PREFIX)) ? "true" : "false");
} else {
char **value;
size_t i, length;
{
char *group, *key;
+ if (STRNCMP_LITERAL (item, BUILT_WITH_PREFIX) == 0) {
+ fprintf (stderr, "Error: read only option: %s\n", item);
+ return 1;
+ }
+
if (_item_split (item, &group, &key))
return 1;
return notmuch_config_save (config);
}
+static
+void
+_notmuch_config_list_built_with ()
+{
+ printf("%scompact=%s\n",
+ BUILT_WITH_PREFIX,
+ notmuch_built_with ("compact") ? "true" : "false");
+ printf("%sfield_processor=%s\n",
+ BUILT_WITH_PREFIX,
+ notmuch_built_with ("field_processor") ? "true" : "false");
+}
+
static int
notmuch_config_command_list (notmuch_config_t *config)
{
g_strfreev (groups);
+ _notmuch_config_list_built_with ();
return 0;
}
test_begin_subtest "List all items"
notmuch config set database.path "/canonical/path"
-output=$(notmuch config list)
+output=$(notmuch config list | notmuch_built_with_sanitize)
test_expect_equal "$output" "\
database.path=/canonical/path
user.name=Notmuch Test Suite
maildir.synchronize_flags=true
crypto.gpg_path=gpg
foo.string=this is another string value
-foo.list=this;is another;list value;"
+foo.list=this;is another;list value;
+built_with.compact=something
+built_with.field_processor=something"
test_begin_subtest "Top level --config=FILE option"
cp "${NOTMUCH_CONFIG}" alt-config
foo bar
baz
EOF
-output=$(notmuch --config=new-notmuch-config config list)
+output=$(notmuch --config=new-notmuch-config config list | notmuch_built_with_sanitize)
test_expect_equal "$output" "\
database.path=/path/to/maildir
user.name=Test Suite
new.ignore=
search.exclude_tags=baz;
maildir.synchronize_flags=true
-crypto.gpg_path=gpg"
+crypto.gpg_path=gpg
+built_with.compact=something
+built_with.field_processor=something"
test_done
{
sed 's/[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/UUID/g'
}
+
+notmuch_built_with_sanitize ()
+{
+ sed 's/^built_with[.]\(.*\)=.*$/built_with.\1=something/'
+}
+
# End of notmuch helper functions
# Use test_set_prereq to tell that a particular prerequisite is available.