- if (notmuch_database_open_with_config (NULL,
- mode,
- config_file_name,
- NULL,
- ¬much,
- &status_string)) {
- if (status_string) {
- fputs (status_string, stderr);
- free (status_string);
+ if (command->mode & NOTMUCH_COMMAND_DATABASE_CREATE) {
+ status = notmuch_database_create_with_config (NULL,
+ config_file_name,
+ NULL,
+ ¬much,
+ &status_string);
+ if (status && status != NOTMUCH_STATUS_DATABASE_EXISTS) {
+ if (status_string) {
+ fputs (status_string, stderr);
+ free (status_string);
+ }
+
+ if (status == NOTMUCH_STATUS_NO_CONFIG)
+ fputs ("Try running 'notmuch setup' to create a configuration.", stderr);
+
+ return EXIT_FAILURE;