builtin/rerere: introduce proper usage strings for subcommands
Adapt git-rerere(1) to have proper usage strings for each of the subcommands. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
1 parent
6f0881eeee
commit
fba7572ebc
2 files changed
+58
-11
No files matched your search
@@ -8,7 +8,13 @@ git-rerere - Reuse recorded resolution of conflicted merges
|
||||
SYNOPSIS
|
||||
--------
|
||||
[verse]
|
||||
'git rerere' [clear | forget <pathspec>... | diff | status | remaining | gc]
|
||||
'git rerere' [--[no-]rerere-autoupdate]
|
||||
'git rerere' clear
|
||||
'git rerere' diff
|
||||
'git rerere' forget <pathspec>...
|
||||
'git rerere' gc
|
||||
'git rerere' remaining
|
||||
'git rerere' status
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
+51
-10
@@ -10,10 +10,13 @@
|
||||
#include "xdiff-interface.h"
|
||||
#include "pathspec.h"
|
||||
|
||||
static const char * const rerere_usage[] = {
|
||||
N_("git rerere [clear | forget <pathspec>... | diff | status | remaining | gc]"),
|
||||
NULL,
|
||||
};
|
||||
#define RERERE_USAGE N_("git rerere [--[no-]rerere-autoupdate]")
|
||||
#define RERERE_CLEAR_USAGE N_("git rerere clear")
|
||||
#define RERERE_DIFF_USAGE N_("git rerere diff")
|
||||
#define RERERE_FORGET_USAGE N_("git rerere forget <pathspec>...")
|
||||
#define RERERE_GC_USAGE N_("git rerere gc")
|
||||
#define RERERE_REMAINING_USAGE N_("git rerere remaining")
|
||||
#define RERERE_STATUS_USAGE N_("git rerere status")
|
||||
|
||||
static int outf(void *dummy UNUSED, mmfile_t *ptr, int nbuf)
|
||||
{
|
||||
@@ -61,9 +64,13 @@ static int cmd_rerere_clear(int argc,
|
||||
struct option options[] = {
|
||||
OPT_END(),
|
||||
};
|
||||
const char * const rerere_clear_usage[] = {
|
||||
RERERE_CLEAR_USAGE,
|
||||
NULL,
|
||||
};
|
||||
struct string_list merge_rr = STRING_LIST_INIT_DUP;
|
||||
|
||||
argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
|
||||
argc = parse_options(argc, argv, prefix, options, rerere_clear_usage, 0);
|
||||
if (argc)
|
||||
usage(_("too many arguments"));
|
||||
|
||||
@@ -81,11 +88,15 @@ static int cmd_rerere_diff(int argc,
|
||||
struct option options[] = {
|
||||
OPT_END(),
|
||||
};
|
||||
const char * const rerere_diff_usage[] = {
|
||||
RERERE_DIFF_USAGE,
|
||||
NULL,
|
||||
};
|
||||
struct string_list merge_rr = STRING_LIST_INIT_DUP;
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
struct rerere_cache cache;
|
||||
|
||||
argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
|
||||
argc = parse_options(argc, argv, prefix, options, rerere_diff_usage, 0);
|
||||
if (argc)
|
||||
usage(_("too many arguments"));
|
||||
|
||||
@@ -115,10 +126,14 @@ static int cmd_rerere_forget(int argc,
|
||||
struct option options[] = {
|
||||
OPT_END(),
|
||||
};
|
||||
const char * const rerere_forget_usage[] = {
|
||||
RERERE_FORGET_USAGE,
|
||||
NULL,
|
||||
};
|
||||
struct pathspec pathspec;
|
||||
int ret;
|
||||
|
||||
argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
|
||||
argc = parse_options(argc, argv, prefix, options, rerere_forget_usage, 0);
|
||||
if (!argc)
|
||||
warning(_("'git rerere forget' without paths is deprecated"));
|
||||
parse_pathspec(&pathspec, 0, PATHSPEC_PREFER_CWD, prefix, argv);
|
||||
@@ -140,9 +155,13 @@ static int cmd_rerere_gc(int argc,
|
||||
N_("skip gc while another process holds the lock")),
|
||||
OPT_END(),
|
||||
};
|
||||
const char * const rerere_gc_usage[] = {
|
||||
RERERE_GC_USAGE,
|
||||
NULL,
|
||||
};
|
||||
struct string_list merge_rr = STRING_LIST_INIT_DUP;
|
||||
|
||||
argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
|
||||
argc = parse_options(argc, argv, prefix, options, rerere_gc_usage, 0);
|
||||
if (argc)
|
||||
usage(_("too many arguments"));
|
||||
|
||||
@@ -164,6 +183,10 @@ static int cmd_rerere_perform(int argc,
|
||||
N_("register clean resolutions in index"), 1),
|
||||
OPT_END(),
|
||||
};
|
||||
const char * const rerere_usage[] = {
|
||||
RERERE_USAGE,
|
||||
NULL,
|
||||
};
|
||||
enum rerere_flags flags = 0;
|
||||
|
||||
argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
|
||||
@@ -186,9 +209,13 @@ static int cmd_rerere_remaining(int argc,
|
||||
struct option options[] = {
|
||||
OPT_END(),
|
||||
};
|
||||
const char * const rerere_remaining_usage[] = {
|
||||
RERERE_REMAINING_USAGE,
|
||||
NULL,
|
||||
};
|
||||
struct string_list merge_rr = STRING_LIST_INIT_DUP;
|
||||
|
||||
argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
|
||||
argc = parse_options(argc, argv, prefix, options, rerere_remaining_usage, 0);
|
||||
if (argc)
|
||||
usage(_("too many arguments"));
|
||||
|
||||
@@ -214,10 +241,14 @@ static int cmd_rerere_status(int argc,
|
||||
struct option options[] = {
|
||||
OPT_END(),
|
||||
};
|
||||
const char * const rerere_status_usage[] = {
|
||||
RERERE_STATUS_USAGE,
|
||||
NULL,
|
||||
};
|
||||
struct string_list merge_rr = STRING_LIST_INIT_DUP;
|
||||
struct rerere_cache cache;
|
||||
|
||||
argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
|
||||
argc = parse_options(argc, argv, prefix, options, rerere_status_usage, 0);
|
||||
if (argc)
|
||||
usage(_("too many arguments"));
|
||||
|
||||
@@ -247,6 +278,16 @@ int cmd_rerere(int argc,
|
||||
OPT_SUBCOMMAND("status", &fn, cmd_rerere_status),
|
||||
OPT_END(),
|
||||
};
|
||||
const char * const rerere_usage[] = {
|
||||
RERERE_USAGE,
|
||||
RERERE_CLEAR_USAGE,
|
||||
RERERE_DIFF_USAGE,
|
||||
RERERE_FORGET_USAGE,
|
||||
RERERE_GC_USAGE,
|
||||
RERERE_REMAINING_USAGE,
|
||||
RERERE_STATUS_USAGE,
|
||||
NULL,
|
||||
};
|
||||
|
||||
argc = parse_options(argc, argv, prefix, options, rerere_usage,
|
||||
PARSE_OPT_KEEP_UNKNOWN_OPT | PARSE_OPT_SUBCOMMAND_OPTIONAL);
|
||||
|
||||
Reference in new issue
Block a user