diff options
| author | David Bremner <david@tethera.net> | 2021-06-12 10:26:17 -0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-10-23 09:51:50 -0300 |
| commit | 2ce6c76a61c907b5d1d508e12255e83d9256937c (patch) | |
| tree | fcb1e35acb341eeaccfdd387fe214b5ba8dab9e6 /notmuch-new.c | |
| parent | c128c995bc3e7474d4086af7e2066f60f54329b2 (diff) | |
CLI: move indexopts variable out of shared options block
This reduces the amount of global state. Furthermore, index options
can be set (in principle) in several ways, not just in the one
function for processing indexing command line options.
Diffstat (limited to 'notmuch-new.c')
| -rw-r--r-- | notmuch-new.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/notmuch-new.c b/notmuch-new.c index b7a5f2ea..5b8fa340 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -45,6 +45,7 @@ typedef struct { const char *db_path; const char *mail_root; + notmuch_indexopts_t *indexopts; int output_is_a_tty; enum verbosity verbosity; bool debug; @@ -376,7 +377,7 @@ add_file (notmuch_database_t *notmuch, const char *filename, if (status) goto DONE; - status = notmuch_database_index_file (notmuch, filename, indexing_cli_choices.opts, &message); + status = notmuch_database_index_file (notmuch, filename, state->indexopts, &message); switch (status) { /* Success. */ case NOTMUCH_STATUS_SUCCESS: @@ -1150,6 +1151,8 @@ notmuch_new_command (notmuch_database_t *notmuch, int argc, char *argv[]) else if (verbose) add_files_state.verbosity = VERBOSITY_VERBOSE; + add_files_state.indexopts = notmuch_database_get_default_indexopts (notmuch); + add_files_state.new_tags = notmuch_config_get_values (notmuch, NOTMUCH_CONFIG_NEW_TAGS); if (print_status_database ( @@ -1217,7 +1220,7 @@ notmuch_new_command (notmuch_database_t *notmuch, int argc, char *argv[]) if (notmuch == NULL) return EXIT_FAILURE; - status = notmuch_process_shared_indexing_options (notmuch); + status = notmuch_process_shared_indexing_options (add_files_state.indexopts); if (status != NOTMUCH_STATUS_SUCCESS) { fprintf (stderr, "Error: Failed to process index options. (%s)\n", notmuch_status_to_string (status)); |
