aboutsummaryrefslogtreecommitdiff
path: root/notmuch.c
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-08-24 08:17:42 -0700
committerDavid Bremner <david@tethera.net>2021-09-04 17:07:19 -0700
commita2e7af5b6986bca5a2bb2752f892cb86a9767b3c (patch)
treedca54e6a7f0a141167e6530813f51b15be92f6d2 /notmuch.c
parent551254eb76c9bb558078f04f21df1f6089cb03d6 (diff)
CLI: move query syntax to shared option
This will allow easy addition of a query syntax option to other subcommands.
Diffstat (limited to 'notmuch.c')
-rw-r--r--notmuch.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/notmuch.c b/notmuch.c
index 3824bf19..3fb58bf2 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -54,14 +54,26 @@ notmuch_exit_if_unmatched_db_uuid (notmuch_database_t *notmuch);
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 = &notmuch_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);