]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-search.c
cli: define shared options, use for --help and --version
[notmuch] / notmuch-search.c
index b81ac0134ef23cbcfec3d37f063a6f758cc99fdf..b89a17e5c4bfd5adeb5c3a9ce4aa74ca1c58da14 100644 (file)
@@ -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;