git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Rubén Justo" <rjusto@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [PATCH 1/3] t/test-tool: usage description
Date: Tue, 09 Jan 2024 10:19:06 -0800	[thread overview]
Message-ID: <xmqqy1cygyjp.fsf@gitster.g> (raw)
In-Reply-To: <ec57072d-0069-4d07-a695-b89436350568@gmail.com> ("Rubén Justo"'s message of "Tue, 9 Jan 2024 16:29:30 +0100")

> 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);

  reply	other threads:[~2024-01-09 18:19 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-09 15:25 [PATCH 0/3] allow disabling the automatic hint in advise_if_enabled() Rubén Justo
2024-01-09 15:29 ` [PATCH 1/3] t/test-tool: usage description Rubén Justo
2024-01-09 18:19   ` Junio C Hamano [this message]
2024-01-09 15:29 ` [PATCH 2/3] t/test-tool: handle -c <name>=<value> arguments Rubén Justo
2024-01-09 18:19   ` Junio C Hamano
2024-01-09 18:20   ` Taylor Blau
2024-01-09 15:30 ` [PATCH 3/3] advice: allow disabling the automatic hint in advise_if_enabled() Rubén Justo
2024-01-09 18:23   ` Junio C Hamano
2024-01-09 18:27   ` Taylor Blau
2024-01-09 19:57     ` Junio C Hamano
2024-01-10 12:11     ` Rubén Justo
2024-01-10 11:02   ` Jeff King
2024-01-10 11:39     ` Rubén Justo
2024-01-10 14:18     ` Dragan Simic
2024-01-10 14:32       ` Rubén Justo
2024-01-10 14:44         ` Dragan Simic
2024-01-10 16:22           ` Junio C Hamano
2024-01-10 17:45             ` Dragan Simic
2024-01-11  8:04               ` Jeff King
2024-01-18  6:15                 ` Dragan Simic
2024-01-18 18:26                   ` Junio C Hamano
2024-01-18 18:53                     ` Dragan Simic
2024-01-18 20:19                       ` Junio C Hamano
2024-01-18 20:50                         ` Dragan Simic
2024-01-20 11:31                           ` Rubén Justo
2024-01-20 15:31                             ` Dragan Simic
2024-01-10 16:14     ` Junio C Hamano
2024-01-09 18:28 ` [PATCH 0/3] " Taylor Blau
2024-01-09 22:32   ` Junio C Hamano
2024-01-10 12:40     ` Rubén Justo
2024-01-12 10:05 ` [PATCH] advice: " Rubén Justo
2024-01-12 22:19   ` Junio C Hamano
2024-01-13  7:38     ` Jeff King
2024-01-16  4:56       ` Junio C Hamano
2024-01-15 11:24     ` Rubén Justo
2024-01-15 14:28   ` [PATCH v2] " Rubén Justo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqy1cygyjp.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=rjusto@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).