From 1a85b49b87af0e17a503b94df10d0b39472ad5b8 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 14 Mar 2019 04:25:04 -0700 Subject: parse-options: make OPT_ARGUMENT() more useful `OPT_ARGUMENT()` is intended to keep the specified long option in `argv` and not to do anything else. However, it would make a lot of sense for the caller to know whether this option was seen at all or not. For example, we want to teach `git difftool` to work outside of any Git worktree, but only when `--no-index` was specified. Note: nothing in Git uses OPT_ARGUMENT(). Even worse, looking through the commit history, one can easily see that nothing even ever used it, apart from the regression test. So not only do we make `OPT_ARGUMENT()` more useful, we are also about to introduce its first real user! Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- parse-options.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'parse-options.h') diff --git a/parse-options.h b/parse-options.h index 7d83e2971d..c3d45ba1ac 100644 --- a/parse-options.h +++ b/parse-options.h @@ -138,8 +138,8 @@ struct option { { OPTION_CALLBACK, (s), (l), (v), (a), (h), (f), (cb) } #define OPT_END() { OPTION_END } -#define OPT_ARGUMENT(l, h) { OPTION_ARGUMENT, 0, (l), NULL, NULL, \ - (h), PARSE_OPT_NOARG} +#define OPT_ARGUMENT(l, v, h) { OPTION_ARGUMENT, 0, (l), (v), NULL, \ + (h), PARSE_OPT_NOARG, NULL, 1 } #define OPT_GROUP(h) { OPTION_GROUP, 0, NULL, NULL, NULL, (h) } #define OPT_BIT(s, l, v, h, b) OPT_BIT_F(s, l, v, h, b, 0) #define OPT_BITOP(s, l, v, h, set, clear) { OPTION_BITOP, (s), (l), (v), NULL, (h), \ -- cgit v1.3-5-g45d5