summaryrefslogtreecommitdiff
path: root/parse-options.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2022-02-25 15:47:35 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-02-25 15:47:35 -0800
commitd21d5ddfe675f9dbcdbb94ab01776115a2d1fdde (patch)
tree3b0761ff79a4e4a5c50263a8d324b6c6a9268e35 /parse-options.c
parentMerge branch 'ab/only-single-progress-at-once' (diff)
parenti18n: fix some misformated placeholders in command synopsis (diff)
downloadtgif-d21d5ddfe675f9dbcdbb94ab01776115a2d1fdde.tar.xz
Merge branch 'ja/i18n-common-messages'
Unify more messages to help l10n. * ja/i18n-common-messages: i18n: fix some misformated placeholders in command synopsis i18n: remove from i18n strings that do not hold translatable parts i18n: factorize "invalid value" messages i18n: factorize more 'incompatible options' messages
Diffstat (limited to 'parse-options.c')
-rw-r--r--parse-options.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/parse-options.c b/parse-options.c
index 2437ad3bcd..6e57744fd2 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -1092,3 +1092,37 @@ void NORETURN usage_msg_optf(const char * const fmt,
usage_msg_opt(msg.buf, 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;
+ }
+}