- int i;
- notmuch_bool_t output_messages = TRUE;
-
- argc--; argv++; /* skip subcommand argument */
-
- for (i = 0; i < argc && argv[i][0] == '-'; i++) {
- if (strcmp (argv[i], "--") == 0) {
- i++;
- break;
- }
- if (STRNCMP_LITERAL (argv[i], "--output=") == 0) {
- const char *opt = argv[i] + sizeof ("--output=") - 1;
- if (strcmp (opt, "threads") == 0) {
- output_messages = FALSE;
- } else if (strcmp (opt, "messages") == 0) {
- output_messages = TRUE;
- } else {
- fprintf (stderr, "Invalid value for --output: %s\n", opt);
- return 1;
- }
- } else {
- fprintf (stderr, "Unrecognized option: %s\n", argv[i]);
- return 1;
- }
- }
+ int opt_index;
+ int output = OUTPUT_MESSAGES;
+ notmuch_bool_t no_exclude = FALSE;
+ unsigned int i;
+
+ notmuch_opt_desc_t options[] = {
+ { NOTMUCH_OPT_KEYWORD, &output, "output", 'o',
+ (notmuch_keyword_t []){ { "threads", OUTPUT_THREADS },
+ { "messages", OUTPUT_MESSAGES },
+ { 0, 0 } } },
+ { NOTMUCH_OPT_BOOLEAN, &no_exclude, "no-exclude", 'd', 0 },
+ { 0, 0, 0, 0, 0 }
+ };