builtin/multi-pack-index.c: define common usage with a macro

Factor out the usage message into pieces corresponding to each mode. This avoids options specific to one sub-command from being shared with another in the usage. A subsequent commit will use these #define macros to have usage variables for each sub-command without duplicating their contents. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Taylor Blau committed Mar 30, 2021 at 11:03 UTC b25b727494f4782c7af1db31fdfde1cc9b30f7c4
1 file changed +16 -1
builtin/multi-pack-index.c
+16 -1
@@ -5,8 +5,23 @@
5 #include "midx.h"
6 #include "trace2.h"
7
8 +#define BUILTIN_MIDX_WRITE_USAGE \
9 + N_("git multi-pack-index [<options>] write")
10 +
11 +#define BUILTIN_MIDX_VERIFY_USAGE \
12 + N_("git multi-pack-index [<options>] verify")
13 +
14 +#define BUILTIN_MIDX_EXPIRE_USAGE \
15 + N_("git multi-pack-index [<options>] expire")
16 +
17 +#define BUILTIN_MIDX_REPACK_USAGE \
18 + N_("git multi-pack-index [<options>] repack [--batch-size=<size>]")
19 +
20 static char const * const builtin_multi_pack_index_usage[] = {
9 - N_("git multi-pack-index [<options>] (write|verify|expire|repack --batch-size=<size>)"),
21 + BUILTIN_MIDX_WRITE_USAGE,
22 + BUILTIN_MIDX_VERIFY_USAGE,
23 + BUILTIN_MIDX_EXPIRE_USAGE,
24 + BUILTIN_MIDX_REPACK_USAGE,
25 NULL
26 };
27