X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=command-line-arguments.h;h=dfc808bdab7838c81746f7671ba2fa8b3b904ce9;hp=4c4d240e10dc17a4e3a966b839a7013c6d40a360;hb=bc99087ff95d0cdada827f3b838d05e0c9448b63;hpb=de9baa29dc990e4166b47dc2b0d0cf560014834b diff --git a/command-line-arguments.h b/command-line-arguments.h index 4c4d240e..dfc808bd 100644 --- a/command-line-arguments.h +++ b/command-line-arguments.h @@ -3,17 +3,6 @@ #include "notmuch.h" -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 */ - NOTMUCH_OPT_KEYWORD_FLAGS, /* the above with values OR'd together */ - NOTMUCH_OPT_STRING, /* --file=/tmp/gnarf.txt */ - NOTMUCH_OPT_POSITION /* notmuch dump pos_arg */ -}; - /* * Describe one of the possibilities for a keyword option * 'value' will be copied to the output variable @@ -24,22 +13,24 @@ typedef struct notmuch_keyword { int value; } notmuch_keyword_t; -/* - * Describe one option. - * - * First two parameters are mandatory. - * - * name is mandatory _except_ for positional arguments. - * - * arg_id is currently unused, but could define short arguments. - * - * keywords is a (possibly NULL) pointer to an array of keywords - */ +/* Describe one option. */ typedef struct notmuch_opt_desc { - enum notmuch_opt_type opt_type; - void *output_var; + /* One and only one of opt_* must be set. */ + const struct notmuch_opt_desc *opt_inherit; + notmuch_bool_t *opt_bool; + int *opt_int; + int *opt_keyword; + int *opt_flags; + const char **opt_string; + const char **opt_position; + + /* Must be set except for opt_inherit and opt_position. */ const char *name; - int arg_id; + + /* Optional, if non-NULL, set to TRUE if the option is present. */ + notmuch_bool_t *present; + + /* Must be set for opt_keyword and opt_flags. */ const struct notmuch_keyword *keywords; } notmuch_opt_desc_t;