static bool print_version = false, print_help = false;
static const char *notmuch_requested_db_uuid = NULL;
+static int query_syntax = NOTMUCH_QUERY_SYNTAX_XAPIAN;
const notmuch_opt_desc_t notmuch_shared_options [] = {
{ .opt_bool = &print_version, .name = "version" },
{ .opt_bool = &print_help, .name = "help" },
{ .opt_string = ¬much_requested_db_uuid, .name = "uuid" },
+ { .opt_keyword = &query_syntax, .name = "query", .keywords =
+ (notmuch_keyword_t []){ { "infix", NOTMUCH_QUERY_SYNTAX_XAPIAN },
+ { "sexp", NOTMUCH_QUERY_SYNTAX_SEXP },
+ { 0, 0 } } },
+
{ }
};
+notmuch_query_syntax_t
+shared_option_query_syntax ()
+{
+ return query_syntax;
+}
+
/* any subcommand wanting to support these options should call
* inherit notmuch_shared_options and call
* notmuch_process_shared_options (notmuch, subcommand_name);
notmuch_status_t
-notmuch_process_shared_indexing_options (notmuch_database_t *notmuch)
+notmuch_process_shared_indexing_options (notmuch_indexopts_t *opts)
{
- if (indexing_cli_choices.opts == NULL)
- indexing_cli_choices.opts = notmuch_database_get_default_indexopts (notmuch);
+ if (opts == NULL)
+ return NOTMUCH_STATUS_NULL_POINTER;
+
if (indexing_cli_choices.decrypt_policy_set) {
notmuch_status_t status;
- if (indexing_cli_choices.opts == NULL)
- return NOTMUCH_STATUS_OUT_OF_MEMORY;
- status = notmuch_indexopts_set_decrypt_policy (indexing_cli_choices.opts,
+ status = notmuch_indexopts_set_decrypt_policy (opts,
indexing_cli_choices.decrypt_policy);
if (status != NOTMUCH_STATUS_SUCCESS) {
fprintf (stderr, "Error: Failed to set index decryption policy to %d. (%s)\n",
indexing_cli_choices.decrypt_policy, notmuch_status_to_string (status));
- notmuch_indexopts_destroy (indexing_cli_choices.opts);
- indexing_cli_choices.opts = NULL;
return status;
}
}