From c8ba163916554e9ffd3ce8cb2beeff003d90c0c3 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 9 Jun 2011 11:55:23 -0400 Subject: parse-options: add OPT_STRING_LIST helper This just adds repeated invocations of an option to a list of strings. Using the "--no-" form will reset the list to empty. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- parse-options.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'parse-options.h') diff --git a/parse-options.h b/parse-options.h index d1b12fe979..05eb09b878 100644 --- a/parse-options.h +++ b/parse-options.h @@ -130,6 +130,9 @@ struct option { (h), PARSE_OPT_NOARG, NULL, (p) } #define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), "n", (h) } #define OPT_STRING(s, l, v, a, h) { OPTION_STRING, (s), (l), (v), (a), (h) } +#define OPT_STRING_LIST(s, l, v, a, h) \ + { OPTION_CALLBACK, (s), (l), (v), (a), \ + (h), 0, &parse_opt_string_list } #define OPT_UYN(s, l, v, h) { OPTION_CALLBACK, (s), (l), (v), NULL, \ (h), PARSE_OPT_NOARG, &parse_opt_tertiary } #define OPT_DATE(s, l, v, h) \ @@ -204,6 +207,7 @@ extern int parse_opt_color_flag_cb(const struct option *, const char *, int); extern int parse_opt_verbosity_cb(const struct option *, const char *, int); extern int parse_opt_with_commit(const struct option *, const char *, int); extern int parse_opt_tertiary(const struct option *, const char *, int); +extern int parse_opt_string_list(const struct option *, const char *, int); #define OPT__VERBOSE(var, h) OPT_BOOLEAN('v', "verbose", (var), (h)) #define OPT__QUIET(var, h) OPT_BOOLEAN('q', "quiet", (var), (h)) -- cgit v1.2.1