- printf ("OK. Let's take a look at the mail we can find in the directory\n");
- printf ("%s ...\n", mail_directory);
-
- count = 0;
- count_files (mail_directory, &count);
-
- printf ("Found %d total files. That's not much mail.\n\n", count);
-
- printf ("Next, we'll inspect the messages and create a database of threads:\n");
-
- add_files_state.total_messages = count;
- add_files_state.count = 0;
- gettimeofday (&add_files_state.tv_start, NULL);
-
- add_files (notmuch, mail_directory, &add_files_state);
-
- gettimeofday (&tv_now, NULL);
- elapsed = tv_elapsed (add_files_state.tv_start,
- tv_now);
- printf ("Added %d total messages in ", add_files_state.count);
- print_formatted_seconds (elapsed);
- printf (" (%d messages/sec.). \n", (int) (add_files_state.count / elapsed));
-
- notmuch_database_close (notmuch);
-
- free (mail_directory);
-
- return 0;
-}
-
-int
-search_command (int argc, char *argv[])
-{
- fprintf (stderr, "Error: search is not implemented yet.\n");
- return 1;
-}
-
-int
-show_command (int argc, char *argv[])
-{
- fprintf (stderr, "Error: show is not implemented yet.\n");
- return 1;
-}
-
-int
-dump_command (int argc, char *argv[])
-{
- fprintf (stderr, "Error: dump is not implemented yet.\n");
- return 1;
-}
-
-int
-restore_command (int argc, char *argv[])
-{
- fprintf (stderr, "Error: restore is not implemented yet.\n");
- return 1;
-}
-
-command_t commands[] = {
- { "setup", setup_command,
- "Interactively setup notmuch for first use.\n"
- "\t\tInvoking notmuch with no command argument will run setup if\n"
- "\t\tthe setup command has not previously been completed." },
- { "search", search_command,
- "<search-term> [...]\n\n"
- "\t\tSearch for threads matching the given search terms.\n"
- "\t\tOnce we actually implement search we'll document the\n"
- "\t\tsyntax here." },
- { "show", show_command,
- "<thread-id>\n\n"
- "\t\tShow the thread with the given thread ID (see 'search')." },
- { "dump", dump_command,
- "[<filename>]\n\n"
- "\t\tCreate a plain-text dump of the tags for each message\n"
- "\t\twriting to the given filename, if any, or to stdout.\n"
- "\t\tThese tags are the only data in the notmuch database\n"
- "\t\tthat can't be recreated from the messages themselves.\n"
- "\t\tThe output of notmuch dump is therefore the only\n"
- "\t\tcritical thing to backup (and much more friendly to\n"
- "\t\tincremental backup than the native database files." },
- { "restore", restore_command,
- "<filename>\n\n"
- "\t\tRestore the tags from the given dump file (see 'dump')." }
-};
-
-void
-usage (void)
-{
- command_t *command;
- int i;