67
{ OPTION_CALLBACK, (s), (l), (v), NULL, (h), PARSE_OPT_NOARG | \
68
PARSE_OPT_NONEG, option_parse_type, (i) }
69
70
-static struct option builtin_config_options[];
70
+static NORETURN void usage_builtin_config(void);
71
72
static int option_parse_type(const struct option *opt, const char *arg,
73
int unset)
111
* --type=int'.
112
*/
113
error("only one type at a time.");
114
- usage_with_options(builtin_config_usage,
115
- builtin_config_options);
114
+ usage_builtin_config();
115
}
116
*to_type = new_type;
117
156
OPT_END(),
157
};
158
159
+static NORETURN void usage_builtin_config(void)
160
+{
161
+ usage_with_options(builtin_config_usage, builtin_config_options);
162
+}
163
+
164
static void check_argc(int argc, int min, int max) {
165
if (argc >= min && argc <= max)
166
return;
167
error("wrong number of arguments");
164
- usage_with_options(builtin_config_usage, builtin_config_options);
168
+ usage_builtin_config();
169
}
170
171
static void show_config_origin(struct strbuf *buf)
600
if (use_global_config + use_system_config + use_local_config +
601
!!given_config_source.file + !!given_config_source.blob > 1) {
602
error("only one config file at a time.");
599
- usage_with_options(builtin_config_usage, builtin_config_options);
603
+ usage_builtin_config();
604
}
605
606
if (use_local_config && nongit)
661
662
if ((actions & (ACTION_GET_COLOR|ACTION_GET_COLORBOOL)) && type) {
663
error("--get-color and variable type are incoherent");
660
- usage_with_options(builtin_config_usage, builtin_config_options);
664
+ usage_builtin_config();
665
}
666
667
if (HAS_MULTI_BITS(actions)) {
668
error("only one action at a time.");
665
- usage_with_options(builtin_config_usage, builtin_config_options);
669
+ usage_builtin_config();
670
}
671
if (actions == 0)
672
switch (argc) {
674
case 2: actions = ACTION_SET; break;
675
case 3: actions = ACTION_SET_ALL; break;
676
default:
673
- usage_with_options(builtin_config_usage, builtin_config_options);
677
+ usage_builtin_config();
678
}
679
if (omit_values &&
680
!(actions == ACTION_LIST || actions == ACTION_GET_REGEXP)) {
681
error("--name-only is only applicable to --list or --get-regexp");
678
- usage_with_options(builtin_config_usage, builtin_config_options);
682
+ usage_builtin_config();
683
}
684
685
if (show_origin && !(actions &
686
(ACTION_GET|ACTION_GET_ALL|ACTION_GET_REGEXP|ACTION_LIST))) {
687
error("--show-origin is only applicable to --get, --get-all, "
688
"--get-regexp, and --list.");
685
- usage_with_options(builtin_config_usage, builtin_config_options);
689
+ usage_builtin_config();
690
}
691
692
if (default_value && !(actions & ACTION_GET)) {
693
error("--default is only applicable to --get");
690
- usage_with_options(builtin_config_usage,
691
- builtin_config_options);
694
+ usage_builtin_config();
695
}
696
697
if (actions & PAGING_ACTIONS)