summaryrefslogtreecommitdiffstats
path: root/notmuch-search.c
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2015-04-05 22:13:03 +0900
committerDavid Bremner <david@tethera.net>2015-06-01 07:32:54 +0200
commit0018a8d787a98f80c665061daa9b0c73839d3666 (patch)
treec24386a37b845ae5f400bcb4bbb178c06af31b75 /notmuch-search.c
parent0706e0e3e2da9abf0487ec91a505de82cf5e5c10 (diff)
cli: define shared options, use for --help and --version
Unfortunately it seems trickier to support --config globally The non-trivial changes are in notmuch.c; most of the other changes consists of blindly inserting two lines into every subcommand.
Diffstat (limited to 'notmuch-search.c')
-rw-r--r--notmuch-search.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/notmuch-search.c b/notmuch-search.c
index b81ac013..b89a17e5 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -681,6 +681,7 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
{ NOTMUCH_OPT_INT, &ctx->limit, "limit", 'L', 0 },
{ NOTMUCH_OPT_INT, &ctx->dupe, "duplicate", 'D', 0 },
{ NOTMUCH_OPT_INHERIT, (void *) &common_options, NULL, 0, 0 },
+ { NOTMUCH_OPT_INHERIT, (void *) &notmuch_shared_options, NULL, 0, 0 },
{ 0, 0, 0, 0, 0 }
};
@@ -689,6 +690,8 @@ notmuch_search_command (notmuch_config_t *config, int argc, char *argv[])
if (opt_index < 0)
return EXIT_FAILURE;
+ notmuch_process_shared_options (argv[0]);
+
if (ctx->output != OUTPUT_FILES && ctx->output != OUTPUT_MESSAGES &&
ctx->dupe != -1) {
fprintf (stderr, "Error: --duplicate=N is only supported with --output=files and --output=messages.\n");
@@ -737,6 +740,7 @@ notmuch_address_command (notmuch_config_t *config, int argc, char *argv[])
{ "false", NOTMUCH_EXCLUDE_FALSE },
{ 0, 0 } } },
{ NOTMUCH_OPT_INHERIT, (void *) &common_options, NULL, 0, 0 },
+ { NOTMUCH_OPT_INHERIT, (void *) &notmuch_shared_options, NULL, 0, 0 },
{ 0, 0, 0, 0, 0 }
};
@@ -744,6 +748,8 @@ notmuch_address_command (notmuch_config_t *config, int argc, char *argv[])
if (opt_index < 0)
return EXIT_FAILURE;
+ notmuch_process_shared_options (argv[0]);
+
if (! (ctx->output & (OUTPUT_SENDER | OUTPUT_RECIPIENTS)))
ctx->output |= OUTPUT_SENDER;