]> git.cworth.org Git - notmuch/blobdiff - notmuch-setup.c
CLI: drop notmuch_config_t from subcommand interface.
[notmuch] / notmuch-setup.c
index e9b81be839a0736a8b30cb24f88a55d1bbf95311..567e3b565359b64018573044828a24d18eb46328 100644 (file)
@@ -124,14 +124,14 @@ parse_tag_list (void *ctx, char *response)
 }
 
 int
-notmuch_setup_command (notmuch_config_t *config,
-                      notmuch_database_t *notmuch,
+notmuch_setup_command (notmuch_database_t *notmuch,
                       int argc, char *argv[])
 {
     char *response = NULL;
     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 +151,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 +237,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 ();