mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-25 04:18:08 +01:00
cli: use the negating boolean support for new and insert --no-hooks
This lets us use the positive hooks variable in code, increasing clarity.
This commit is contained in:
parent
39abd3b522
commit
e29ec5f0e9
2 changed files with 7 additions and 7 deletions
|
@ -456,7 +456,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
|
||||||
const char *folder = "";
|
const char *folder = "";
|
||||||
bool create_folder = false;
|
bool create_folder = false;
|
||||||
bool keep = false;
|
bool keep = false;
|
||||||
bool no_hooks = false;
|
bool hooks = true;
|
||||||
bool synchronize_flags;
|
bool synchronize_flags;
|
||||||
char *maildir;
|
char *maildir;
|
||||||
char *newpath;
|
char *newpath;
|
||||||
|
@ -467,7 +467,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
|
||||||
{ .opt_string = &folder, .name = "folder", .allow_empty = true },
|
{ .opt_string = &folder, .name = "folder", .allow_empty = true },
|
||||||
{ .opt_bool = &create_folder, .name = "create-folder" },
|
{ .opt_bool = &create_folder, .name = "create-folder" },
|
||||||
{ .opt_bool = &keep, .name = "keep" },
|
{ .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_indexing_options },
|
||||||
{ .opt_inherit = notmuch_shared_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. */
|
/* Ignore hook failures. */
|
||||||
notmuch_run_hook (db_path, "post-insert");
|
notmuch_run_hook (db_path, "post-insert");
|
||||||
}
|
}
|
||||||
|
|
|
@ -954,7 +954,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
|
||||||
int opt_index;
|
int opt_index;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
bool timer_is_active = false;
|
bool timer_is_active = false;
|
||||||
bool no_hooks = false;
|
bool hooks = true;
|
||||||
bool quiet = false, verbose = false;
|
bool quiet = false, verbose = false;
|
||||||
notmuch_status_t status;
|
notmuch_status_t status;
|
||||||
|
|
||||||
|
@ -962,7 +962,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
|
||||||
{ .opt_bool = &quiet, .name = "quiet" },
|
{ .opt_bool = &quiet, .name = "quiet" },
|
||||||
{ .opt_bool = &verbose, .name = "verbose" },
|
{ .opt_bool = &verbose, .name = "verbose" },
|
||||||
{ .opt_bool = &add_files_state.debug, .name = "debug" },
|
{ .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_indexing_options },
|
||||||
{ .opt_inherit = notmuch_shared_options },
|
{ .opt_inherit = notmuch_shared_options },
|
||||||
{ }
|
{ }
|
||||||
|
@ -996,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");
|
ret = notmuch_run_hook (db_path, "pre-new");
|
||||||
if (ret)
|
if (ret)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
@ -1168,7 +1168,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
|
||||||
|
|
||||||
notmuch_database_destroy (notmuch);
|
notmuch_database_destroy (notmuch);
|
||||||
|
|
||||||
if (!no_hooks && !ret && !interrupted)
|
if (hooks && !ret && !interrupted)
|
||||||
ret = notmuch_run_hook (db_path, "post-new");
|
ret = notmuch_run_hook (db_path, "post-new");
|
||||||
|
|
||||||
if (ret || interrupted)
|
if (ret || interrupted)
|
||||||
|
|
Loading…
Reference in a new issue