summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin-replace.c2
-rw-r--r--parse-options.c8
-rw-r--r--parse-options.h4
3 files changed, 13 insertions, 1 deletions
diff --git a/builtin-replace.c b/builtin-replace.c
index e3767b9661..8220d6eb38 100644
--- a/builtin-replace.c
+++ b/builtin-replace.c
@@ -121,7 +121,7 @@ int cmd_replace(int argc, const char **argv, const char *prefix)
OPT_END()
};
- argc = parse_options(argc, argv, options, git_replace_usage, 0);
+ argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0);
if (list && delete)
usage_with_options(git_replace_usage, options);
diff --git a/parse-options.c b/parse-options.c
index b85cab2466..743f5bae4e 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -555,6 +555,14 @@ void usage_with_options(const char * const *usagestr,
exit(129);
}
+void usage_msg_opt(const char *msg,
+ const char * const *usagestr,
+ const struct option *options)
+{
+ fprintf(stderr, "%s\n\n", msg);
+ usage_with_options(usagestr, options);
+}
+
int parse_options_usage(const char * const *usagestr,
const struct option *opts)
{
diff --git a/parse-options.h b/parse-options.h
index b374ade95c..f0f885c67d 100644
--- a/parse-options.h
+++ b/parse-options.h
@@ -132,6 +132,10 @@ extern int parse_options(int argc, const char **argv, const char *prefix,
extern NORETURN void usage_with_options(const char * const *usagestr,
const struct option *options);
+extern NORETURN void usage_msg_opt(const char *msg,
+ const char * const *usagestr,
+ const struct option *options);
+
/*----- incremental advanced APIs -----*/
enum {