* --int' and '--type=bool
* --type=int'.
*/
- error("only one type at a time.");
+ error("only one type at a time");
usage_with_options(builtin_config_usage,
builtin_config_options);
}
static void check_argc(int argc, int min, int max) {
if (argc >= min && argc <= max)
return;
- error("wrong number of arguments");
+ if (min == max)
+ error("wrong number of arguments, should be %d", min);
+ else
+ error("wrong number of arguments, should be from %d to %d",
+ min, max);
usage_with_options(builtin_config_usage, builtin_config_options);
}
return xstrdup(value);
}
- die("BUG: cannot normalize type %d", type);
+ BUG("cannot normalize type %d", type);
}
static int get_color_found;
if (use_global_config + use_system_config + use_local_config +
!!given_config_source.file + !!given_config_source.blob > 1) {
- error("only one config file at a time.");
+ error("only one config file at a time");
usage_with_options(builtin_config_usage, builtin_config_options);
}
if (use_local_config && nongit)
die(_("--local can only be used inside a git repository"));
+ if (given_config_source.blob && nongit)
+ die(_("--blob can only be used inside a git repository"));
+
if (given_config_source.file &&
!strcmp(given_config_source.file, "-")) {
given_config_source.file = NULL;
}
if (HAS_MULTI_BITS(actions)) {
- error("only one action at a time.");
+ error("only one action at a time");
usage_with_options(builtin_config_usage, builtin_config_options);
}
if (actions == 0)
if (show_origin && !(actions &
(ACTION_GET|ACTION_GET_ALL|ACTION_GET_REGEXP|ACTION_LIST))) {
error("--show-origin is only applicable to --get, --get-all, "
- "--get-regexp, and --list.");
+ "--get-regexp, and --list");
usage_with_options(builtin_config_usage, builtin_config_options);
}
if (ret < 0)
return ret;
if (ret == 0)
- die("No such section!");
+ die("no such section: %s", argv[0]);
}
else if (actions == ACTION_REMOVE_SECTION) {
int ret;
if (ret < 0)
return ret;
if (ret == 0)
- die("No such section!");
+ die("no such section: %s", argv[0]);
}
else if (actions == ACTION_GET_COLOR) {
check_argc(argc, 1, 2);