*/
static notmuch_status_t
add_file (notmuch_database_t *notmuch, const char *path, tag_op_list_t *tag_ops,
- bool synchronize_flags, bool keep)
+ bool synchronize_flags, bool keep,
+ notmuch_indexopts_t *indexopts)
{
notmuch_message_t *message;
notmuch_status_t status;
- status = notmuch_database_index_file (notmuch, path, NULL, &message);
+ status = notmuch_database_index_file (notmuch, path, indexopts, &message);
if (status == NOTMUCH_STATUS_SUCCESS) {
status = tag_op_list_apply (message, tag_ops, 0);
if (status) {
const char *folder = "";
bool create_folder = false;
bool keep = false;
- bool no_hooks = false;
+ bool hooks = true;
bool synchronize_flags;
char *maildir;
char *newpath;
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 },
{ }
};
notmuch_exit_if_unmatched_db_uuid (notmuch);
+ 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;
+ }
/* Index the message. */
- status = add_file (notmuch, newpath, tag_ops, synchronize_flags, keep);
+ status = add_file (notmuch, newpath, tag_ops, synchronize_flags, keep, indexing_cli_choices.opts);
/* Commit changes. */
close_status = notmuch_database_destroy (notmuch);
}
}
- if (! no_hooks && status == NOTMUCH_STATUS_SUCCESS) {
+ if (hooks && status == NOTMUCH_STATUS_SUCCESS) {
/* Ignore hook failures. */
notmuch_run_hook (db_path, "post-insert");
}