diff options
author | Jean-Noël Avila <jn.avila@free.fr> | 2022-01-31 22:07:46 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-02-04 13:58:28 -0800 |
commit | a699367bb8749a338aefb092c5d7ac75c69d61e1 (patch) | |
tree | c09bbd28e122a8a2b718fed0c41fbecd743ad8cf /parse-options.c | |
parent | Sync with Git 2.35.1 (diff) | |
download | tgif-a699367bb8749a338aefb092c5d7ac75c69d61e1.tar.xz |
i18n: factorize more 'incompatible options' messages
Find more incompatible options to factorize.
When more than two options are mutually exclusive, print the ones
which are actually on the command line.
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options.c')
-rw-r--r-- | parse-options.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/parse-options.c b/parse-options.c index a8283037be..276e3911a7 100644 --- a/parse-options.c +++ b/parse-options.c @@ -1079,3 +1079,37 @@ void NORETURN usage_msg_opt(const char *msg, die_message("%s\n", msg); /* The extra \n is intentional */ usage_with_options(usagestr, options); } + +void die_for_incompatible_opt4(int opt1, const char *opt1_name, + int opt2, const char *opt2_name, + int opt3, const char *opt3_name, + int opt4, const char *opt4_name) +{ + int count = 0; + const char *options[4]; + + if (opt1) + options[count++] = opt1_name; + if (opt2) + options[count++] = opt2_name; + if (opt3) + options[count++] = opt3_name; + if (opt4) + options[count++] = opt4_name; + switch (count) { + case 4: + die(_("options '%s', '%s', '%s', and '%s' cannot be used together"), + opt1_name, opt2_name, opt3_name, opt4_name); + break; + case 3: + die(_("options '%s', '%s', and '%s' cannot be used together"), + options[0], options[1], options[2]); + break; + case 2: + die(_("options '%s' and '%s' cannot be used together"), + options[0], options[1]); + break; + default: + break; + } +} |