-/* Examine 'path' recursively as follows:
- *
- * o Ask the filesystem for the mtime of 'path' (path_mtime)
- *
- * o Ask the database for its timestamp of 'path' (path_dbtime)
- *
- * o If 'path_mtime' > 'path_dbtime'
- *
- * o For each regular file in 'path' with mtime newer than the
- * 'path_dbtime' call add_message to add the file to the
- * database.
- *
- * o For each sub-directory of path, recursively call into this
- * same function.
- *
- * o Tell the database to update its time of 'path' to 'path_mtime'
- */
-notmuch_status_t
-add_files (notmuch_database_t *notmuch, const char *path,
- add_files_state_t *state)
-{
- DIR *dir = NULL;
- struct dirent *e, *entry = NULL;
- int entry_length;
- int err;
- char *next = NULL;
- struct stat st;
- time_t path_mtime, path_dbtime;
- notmuch_status_t status, ret = NOTMUCH_STATUS_SUCCESS;
-
- if (stat (path, &st)) {
- fprintf (stderr, "Error reading directory %s: %s\n",
- path, strerror (errno));
- return NOTMUCH_STATUS_FILE_ERROR;
- }
-
- if (! S_ISDIR (st.st_mode)) {
- fprintf (stderr, "Error: %s is not a directory.\n", path);
- return NOTMUCH_STATUS_FILE_ERROR;
- }
-
- path_mtime = st.st_mtime;
-
- path_dbtime = notmuch_database_get_timestamp (notmuch, path);
+static command_t commands[] = {
+ { NULL, notmuch_command, TRUE,
+ "Notmuch main command." },
+ { "setup", notmuch_setup_command, TRUE,
+ "Interactively set up notmuch for first use." },
+ { "new", notmuch_new_command, FALSE,
+ "Find and import new messages to the notmuch database." },
+ { "insert", notmuch_insert_command, FALSE,
+ "Add a new message into the maildir and notmuch database." },
+ { "search", notmuch_search_command, FALSE,
+ "Search for messages matching the given search terms." },
+ { "address", notmuch_address_command, FALSE,
+ "Get addresses from messages matching the given search terms." },
+ { "show", notmuch_show_command, FALSE,
+ "Show all messages matching the search terms." },
+ { "count", notmuch_count_command, FALSE,
+ "Count messages matching the search terms." },
+ { "reply", notmuch_reply_command, FALSE,
+ "Construct a reply template for a set of messages." },
+ { "tag", notmuch_tag_command, FALSE,
+ "Add/remove tags for all messages matching the search terms." },
+ { "dump", notmuch_dump_command, FALSE,
+ "Create a plain-text dump of the tags for each message." },
+ { "restore", notmuch_restore_command, FALSE,
+ "Restore the tags from the given dump file (see 'dump')." },
+ { "compact", notmuch_compact_command, FALSE,
+ "Compact the notmuch database." },
+ { "config", notmuch_config_command, FALSE,
+ "Get or set settings in the notmuch configuration file." },
+ { "help", notmuch_help_command, TRUE, /* create but don't save config */
+ "This message, or more detailed help for the named command." }
+};