*/
notmuch_bool_t
-parse_option (const char *arg,
- const notmuch_opt_desc_t *options) {
-
- assert(arg);
+parse_option (const char *_arg, const notmuch_opt_desc_t *options)
+{
+ assert(_arg);
assert(options);
- arg += 2;
-
+ const char *arg = _arg + 2; /* _arg starts with -- */
const notmuch_opt_desc_t *try;
for (try = options; try->opt_type != NOTMUCH_OPT_END; try++) {
+ if (try->opt_type == NOTMUCH_OPT_INHERIT &&
+ parse_option (_arg, try->output_var))
+ return TRUE;
+
if (! try->name)
continue;
/*UNREACHED*/
}
}
- fprintf (stderr, "Unrecognized option: --%s\n", arg);
return FALSE;
}
if (more_args) {
opt_index++;
} else {
+ fprintf (stderr, "Unrecognized option: %s\n", argv[opt_index]);
opt_index = -1;
}
enum notmuch_opt_type {
NOTMUCH_OPT_END = 0,
+ NOTMUCH_OPT_INHERIT, /* another options table */
NOTMUCH_OPT_BOOLEAN, /* --verbose */
NOTMUCH_OPT_INT, /* --frob=8 */
NOTMUCH_OPT_KEYWORD, /* --format=raw|json|text */