mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-29 14:14:12 +01:00
Add some explanation about NOTMUCH_BASE to setup_command.
Since we allow the user to enter a custom directory, we need to let the user know how to make this persistent. Of course, a better answer would be to take what the user entered and shove it into a ~/.notmuch-config file or so, but for now this will have to do.
This commit is contained in:
parent
55c8ee9a86
commit
67a0ee2ebb
1 changed files with 21 additions and 8 deletions
29
notmuch.c
29
notmuch.c
|
@ -285,7 +285,7 @@ int
|
||||||
setup_command (int argc, char *argv[])
|
setup_command (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
notmuch_database_t *notmuch;
|
notmuch_database_t *notmuch;
|
||||||
char *mail_directory;
|
char *mail_directory, *default_path;
|
||||||
int count;
|
int count;
|
||||||
add_files_state_t add_files_state;
|
add_files_state_t add_files_state;
|
||||||
double elapsed;
|
double elapsed;
|
||||||
|
@ -310,19 +310,32 @@ setup_command (int argc, char *argv[])
|
||||||
"such as mb2md. In that case, press Control-C now and run notmuch again\n"
|
"such as mb2md. In that case, press Control-C now and run notmuch again\n"
|
||||||
"once the conversion is complete.\n\n");
|
"once the conversion is complete.\n\n");
|
||||||
|
|
||||||
{
|
|
||||||
char *default_path = notmuch_database_default_path ();
|
default_path = notmuch_database_default_path ();
|
||||||
printf ("Top-level mail directory [%s]: ", default_path);
|
printf ("Top-level mail directory [%s]: ", default_path);
|
||||||
free (default_path);
|
fflush (stdout);
|
||||||
fflush (stdout);
|
|
||||||
}
|
|
||||||
|
|
||||||
mail_directory = read_line ();
|
mail_directory = read_line ();
|
||||||
|
printf ("\n");
|
||||||
|
|
||||||
if (mail_directory == NULL || strlen (mail_directory) == 0) {
|
if (mail_directory == NULL || strlen (mail_directory) == 0) {
|
||||||
if (mail_directory)
|
if (mail_directory)
|
||||||
free (mail_directory);
|
free (mail_directory);
|
||||||
mail_directory = notmuch_database_default_path ();
|
mail_directory = default_path;
|
||||||
|
} else {
|
||||||
|
/* XXX: Instead of telling the user to use an environment
|
||||||
|
* variable here, we should really be writing out a configuration
|
||||||
|
* file and loading that on the next run. */
|
||||||
|
if (strcmp (mail_directory, default_path)) {
|
||||||
|
printf ("Note: Since you are not using the default path, you will want to set\n"
|
||||||
|
"the NOTMUCH_BASE environment variable to %s so that\n"
|
||||||
|
"future calls to notmuch commands will know where to find your mail.\n",
|
||||||
|
mail_directory);
|
||||||
|
printf ("For example, if you are using bash for your shell, add:\n\n");
|
||||||
|
printf ("\texport NOTMUCH_BASE=%s\n\n", mail_directory);
|
||||||
|
printf ("to your ~/.bashrc file.\n\n");
|
||||||
|
}
|
||||||
|
free (default_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
notmuch = notmuch_database_create (mail_directory);
|
notmuch = notmuch_database_create (mail_directory);
|
||||||
|
|
Loading…
Reference in a new issue