Message ID | ec57072d-0069-4d07-a695-b89436350568@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | allow disabling the automatic hint in advise_if_enabled() | expand |
> Subject: Re: [PATCH 1/3] t/test-tool: usage description Good eyes to spot the missing close-angle-bracket. I'll add some missing verb, e.g. "fix usage string", while queuing. I would not bother replacing the fprintf() format string in the same patch. Hits from $ git grep '"usage:' t/helper indicates that far less than half (3 among 12) reuses usage_str[] for this purpose. Making these "usage:" strings come from a unified API (perhaps parse_options() family of functions have something more appropriate than ad-hoc use of fprintf()? I didn't check) might be a welcome change but that is clearly outside the scope of the mark-up fix, and I do not see touching only this one that still uses fprintf() advances toward such a goal. t/helper/test-chmtime.c: fprintf(stderr, "usage: %s %s\n", argv[0], usage_str); t/helper/test-delta.c: fprintf(stderr, "usage: %s\n", usage_str); t/helper/test-windows-named-pipe.c: fprintf(stderr, "usage: %s %s\n", argv[0], usage_string); t/helper/test-advise.c: die("usage: %s <advice>", argv[0]); t/helper/test-csprng.c: fprintf(stderr, "usage: %s [<size>]\n", argv[0]); t/helper/test-genrandom.c: fprintf(stderr, "usage: %s <seed_string> [<size>]\n", argv[0]); t/helper/test-genzeros.c: fprintf(stderr, "usage: %s [<count>]\n", argv[0]); t/helper/test-hash-speed.c: die("usage: test-tool hash-speed algo_name"); t/helper/test-mergesort.c: fprintf(stderr, "usage: test-tool mergesort generate <distribution> <mode> <n> <m>\n"); t/helper/test-strcmp-offset.c: die("usage: %s <string1> <string2>", argv[0]); t/helper/test-tool.c: fprintf(stderr, "usage: test-tool <toolname> [args]\n"); > Even though this is an internal tool, let's keep the usage description > correct and well organized. > > Signed-off-by: Rubén Justo <rjusto@gmail.com> > --- > t/helper/test-tool.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c > index 37ba996539..d9f57c20db 100644 > --- a/t/helper/test-tool.c > +++ b/t/helper/test-tool.c > @@ -5,7 +5,7 @@ > #include "parse-options.h" > > static const char * const test_tool_usage[] = { > - "test-tool [-C <directory>] <command [<arguments>...]]", > + "test-tool [-C <directory>] <command> [<arguments>...]]", > NULL > }; > > @@ -100,7 +100,7 @@ static NORETURN void die_usage(void) > { > size_t i; > > - fprintf(stderr, "usage: test-tool <toolname> [args]\n"); > + fprintf(stderr, "usage: %s\n", test_tool_usage[0]); > for (i = 0; i < ARRAY_SIZE(cmds); i++) > fprintf(stderr, " %s\n", cmds[i].name); > exit(128);
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c index 37ba996539..d9f57c20db 100644 --- a/t/helper/test-tool.c +++ b/t/helper/test-tool.c @@ -5,7 +5,7 @@ #include "parse-options.h" static const char * const test_tool_usage[] = { - "test-tool [-C <directory>] <command [<arguments>...]]", + "test-tool [-C <directory>] <command> [<arguments>...]]", NULL }; @@ -100,7 +100,7 @@ static NORETURN void die_usage(void) { size_t i; - fprintf(stderr, "usage: test-tool <toolname> [args]\n"); + fprintf(stderr, "usage: %s\n", test_tool_usage[0]); for (i = 0; i < ARRAY_SIZE(cmds); i++) fprintf(stderr, " %s\n", cmds[i].name); exit(128);
Even though this is an internal tool, let's keep the usage description correct and well organized. Signed-off-by: Rubén Justo <rjusto@gmail.com> --- t/helper/test-tool.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)