]> git.notmuchmail.org Git - notmuch/blobdiff - notmuch-insert.c
cli: use the negating boolean support for new and insert --no-hooks
[notmuch] / notmuch-insert.c
index 4d6b0a7fba2feb66d7d8ae3de5ca77cf5aa0bfce..48490b51deb26c315bae42b9a7591c828d7c45a7 100644 (file)
@@ -456,7 +456,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
     const char *folder = "";
     bool create_folder = false;
     bool keep = false;
-    bool no_hooks = false;
+    bool hooks = true;
     bool synchronize_flags;
     char *maildir;
     char *newpath;
@@ -464,10 +464,10 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
     unsigned int i;
 
     notmuch_opt_desc_t options[] = {
-       { .opt_string = &folder, .name = "folder" },
+       { .opt_string = &folder, .name = "folder", .allow_empty = true },
        { .opt_bool = &create_folder, .name = "create-folder" },
        { .opt_bool = &keep, .name = "keep" },
-       { .opt_bool =  &no_hooks, .name = "no-hooks" },
+       { .opt_bool =  &hooks, .name = "hooks" },
        { .opt_inherit = notmuch_shared_indexing_options },
        { .opt_inherit = notmuch_shared_options },
        { }
@@ -581,7 +581,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
        }
     }
 
-    if (! no_hooks && status == NOTMUCH_STATUS_SUCCESS) {
+    if (hooks && status == NOTMUCH_STATUS_SUCCESS) {
        /* Ignore hook failures. */
        notmuch_run_hook (db_path, "post-insert");
     }