- enum {
- NOTMUCH_FORMAT_JSON,
- NOTMUCH_FORMAT_TEXT,
- NOTMUCH_FORMAT_TEXT0,
- NOTMUCH_FORMAT_SEXP
- } format_sel = NOTMUCH_FORMAT_TEXT;
-
- notmuch_opt_desc_t options[] = {
- { NOTMUCH_OPT_KEYWORD, &opt.sort, "sort", 's',
- (notmuch_keyword_t []){ { "oldest-first", NOTMUCH_SORT_OLDEST_FIRST },
- { "newest-first", NOTMUCH_SORT_NEWEST_FIRST },
- { 0, 0 } } },
- { NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f',
- (notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
- { "sexp", NOTMUCH_FORMAT_SEXP },
- { "text", NOTMUCH_FORMAT_TEXT },
- { "text0", NOTMUCH_FORMAT_TEXT0 },
- { 0, 0 } } },
- { NOTMUCH_OPT_INT, ¬much_format_version, "format-version", 0, 0 },
- { NOTMUCH_OPT_KEYWORD_FLAGS, &opt.output, "output", 'o',
- (notmuch_keyword_t []){ { "summary", OUTPUT_SUMMARY },
- { "threads", OUTPUT_THREADS },
- { "messages", OUTPUT_MESSAGES },
- { "sender", OUTPUT_SENDER },
- { "recipients", OUTPUT_RECIPIENTS },
- { "files", OUTPUT_FILES },
- { "tags", OUTPUT_TAGS },
- { 0, 0 } } },
- { NOTMUCH_OPT_KEYWORD, &exclude, "exclude", 'x',
- (notmuch_keyword_t []){ { "true", NOTMUCH_EXCLUDE_TRUE },
- { "false", NOTMUCH_EXCLUDE_FALSE },
- { "flag", NOTMUCH_EXCLUDE_FLAG },
- { "all", NOTMUCH_EXCLUDE_ALL },
- { 0, 0 } } },
- { NOTMUCH_OPT_INT, &opt.offset, "offset", 'O', 0 },
- { NOTMUCH_OPT_INT, &opt.limit, "limit", 'L', 0 },
- { NOTMUCH_OPT_INT, &opt.dupe, "duplicate", 'D', 0 },
- { 0, 0, 0, 0, 0 }
- };
-
- opt_index = parse_arguments (argc, argv, options, 1);
- if (opt_index < 0)
- return EXIT_FAILURE;
-
- if (! opt.output)
- opt.output = OUTPUT_SUMMARY;
-
- switch (format_sel) {