diff options
| author | David Bremner <david@tethera.net> | 2021-02-27 09:22:32 -0400 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2021-04-06 21:32:36 -0300 |
| commit | ec4b7efbe4bd6d50bd6046bac5f7ef4ceaa30154 (patch) | |
| tree | eddfc4417ad06ddb22498aeabaef37c15810781a /notmuch-setup.c | |
| parent | 77d4b26d3e374afac0012148a8ac0a08158406f1 (diff) | |
CLI/config: remove calls to notmuch_config_open from top level
This will allow simplifying the subcommand interface.
Change the internal API to notmuch_config_open to not tie it to the
implementation of subcommands in notmuch.c.
It also fixes a previously broken test, since notmuch_config_open does
not understand the notion of the empty string as a config file name.
Diffstat (limited to 'notmuch-setup.c')
| -rw-r--r-- | notmuch-setup.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/notmuch-setup.c b/notmuch-setup.c index e9b81be8..221ce934 100644 --- a/notmuch-setup.c +++ b/notmuch-setup.c @@ -124,7 +124,7 @@ parse_tag_list (void *ctx, char *response) } int -notmuch_setup_command (notmuch_config_t *config, +notmuch_setup_command (unused(notmuch_config_t *config), notmuch_database_t *notmuch, int argc, char *argv[]) { @@ -132,6 +132,7 @@ notmuch_setup_command (notmuch_config_t *config, size_t response_size = 0; GPtrArray *other_emails; notmuch_config_values_t *new_tags, *search_exclude_tags, *emails; + notmuch_config_t *config; #define prompt(format, ...) \ do { \ @@ -151,6 +152,11 @@ notmuch_setup_command (notmuch_config_t *config, fprintf (stderr, "Warning: ignoring --uuid=%s\n", notmuch_requested_db_uuid); + config = notmuch_config_open (notmuch, + notmuch_config_path (notmuch), true); + if (! config) + return EXIT_FAILURE; + if (notmuch_config_is_new (config)) welcome_message_pre_setup (); @@ -232,6 +238,9 @@ notmuch_setup_command (notmuch_config_t *config, if (notmuch_config_save (config)) return EXIT_FAILURE; + if (config) + notmuch_config_close (config); + if (notmuch_config_is_new (config)) welcome_message_post_setup (); |
