summaryrefslogtreecommitdiff
path: root/parse-options-cb.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse-options-cb.c')
-rw-r--r--parse-options-cb.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/parse-options-cb.c b/parse-options-cb.c
index 8c9edce52f..2733393546 100644
--- a/parse-options-cb.c
+++ b/parse-options-cb.c
@@ -18,7 +18,8 @@ int parse_opt_abbrev_cb(const struct option *opt, const char *arg, int unset)
} else {
v = strtol(arg, (char **)&arg, 10);
if (*arg)
- return opterror(opt, "expects a numerical value", 0);
+ return error(_("option `%s' expects a numerical value"),
+ opt->long_name);
if (v && v < MINIMUM_ABBREV)
v = MINIMUM_ABBREV;
else if (v > 40)
@@ -47,8 +48,8 @@ int parse_opt_color_flag_cb(const struct option *opt, const char *arg,
arg = unset ? "never" : (const char *)opt->defval;
value = git_config_colorbool(NULL, arg);
if (value < 0)
- return opterror(opt,
- "expects \"always\", \"auto\", or \"never\"", 0);
+ return error(_("option `%s' expects \"always\", \"auto\", or \"never\""),
+ opt->long_name);
*(int *)opt->value = value;
return 0;
}
@@ -169,9 +170,12 @@ int parse_opt_noop_cb(const struct option *opt, const char *arg, int unset)
* "-h" output even if it's not being handled directly by
* parse_options().
*/
-int parse_opt_unknown_cb(const struct option *opt, const char *arg, int unset)
+enum parse_opt_result parse_opt_unknown_cb(struct parse_opt_ctx_t *ctx,
+ const struct option *opt,
+ const char *arg, int unset)
{
- return -2;
+ BUG_ON_OPT_ARG(arg);
+ return PARSE_OPT_UNKNOWN;
}
/**