]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-new.c
doc: arrange search prefix documentation in a definition list
[notmuch] / notmuch-new.c
index 0f50457eb8947bf76f1bdf838ccc700ea6e28550..b0a91b0e73157cc89a360662fcf26038fa2958e5 100644 (file)
@@ -267,7 +267,7 @@ add_file (notmuch_database_t *notmuch, const char *filename,
     if (status)
        goto DONE;
 
-    status = notmuch_database_index_file (notmuch, filename, NULL, &message);
+    status = notmuch_database_index_file (notmuch, filename, indexing_cli_choices.opts, &message);
     switch (status) {
     /* Success. */
     case NOTMUCH_STATUS_SUCCESS:
@@ -954,7 +954,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
     int opt_index;
     unsigned int i;
     bool timer_is_active = false;
-    bool no_hooks = false;
+    bool hooks = true;
     bool quiet = false, verbose = false;
     notmuch_status_t status;
 
@@ -962,7 +962,8 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
        { .opt_bool = &quiet, .name = "quiet" },
        { .opt_bool = &verbose, .name = "verbose" },
        { .opt_bool = &add_files_state.debug, .name = "debug" },
-       { .opt_bool = &no_hooks, .name = "no-hooks" },
+       { .opt_bool = &hooks, .name = "hooks" },
+       { .opt_inherit = notmuch_shared_indexing_options },
        { .opt_inherit = notmuch_shared_options },
        { }
     };
@@ -995,7 +996,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
        }
     }
 
-    if (!no_hooks) {
+    if (hooks) {
        ret = notmuch_run_hook (db_path, "pre-new");
        if (ret)
            return EXIT_FAILURE;
@@ -1080,6 +1081,13 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
     if (notmuch == NULL)
        return EXIT_FAILURE;
 
+    status = notmuch_process_shared_indexing_options (notmuch, config);
+    if (status != NOTMUCH_STATUS_SUCCESS) {
+       fprintf (stderr, "Error: Failed to process index options. (%s)\n",
+                notmuch_status_to_string (status));
+       return EXIT_FAILURE;
+    }
+
     /* Set up our handler for SIGINT. We do this after having
      * potentially done a database upgrade we this interrupt handler
      * won't support. */
@@ -1160,7 +1168,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
 
     notmuch_database_destroy (notmuch);
 
-    if (!no_hooks && !ret && !interrupted)
+    if (hooks && !ret && !interrupted)
        ret = notmuch_run_hook (db_path, "post-new");
 
     if (ret || interrupted)