diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2019-03-14 14:25:04 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-03-18 05:44:14 +0300 |
commit | 1a85b49b87af0e17a503b94df10d0b39472ad5b8 (patch) | |
tree | 134e30676e6d083164858ce3bb7d40b914509f27 /parse-options.h | |
parent | 1dcda05820f1044a2ab35867c1fee1f829d2b92c (diff) |
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 <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options.h')
-rw-r--r-- | parse-options.h | 4 |
1 files changed, 2 insertions, 2 deletions
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), \ |