Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	linux-gpio@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [libgpiod][PATCH] tools: clarify the non-option arguments in help text
Date: Tue, 4 Jul 2023 20:50:56 +0800	[thread overview]
Message-ID: <ZKQVsPrhMEXwavIf@sol> (raw)
In-Reply-To: <20230704121222.314617-1-brgl@bgdev.pl>

On Tue, Jul 04, 2023 at 02:12:22PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> We already use [] for optional and <> for required arguments in help text
> but let's make it clear that we can pass multiple chips/lines and in most
> tools only the first one is required.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---
>  tools/gpiodetect.c | 2 +-
>  tools/gpioget.c    | 2 +-
>  tools/gpioinfo.c   | 2 +-
>  tools/gpiomon.c    | 2 +-
>  tools/gpionotify.c | 2 +-
>  tools/gpioset.c    | 2 +-
>  6 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/gpiodetect.c b/tools/gpiodetect.c
> index 0a3461b..569cdfe 100644
> --- a/tools/gpiodetect.c
> +++ b/tools/gpiodetect.c
> @@ -12,7 +12,7 @@
>  
>  static void print_help(void)
>  {
> -	printf("Usage: %s [OPTIONS] [chip]...\n", get_prog_name());
> +	printf("Usage: %s [OPTIONS] [chip1] [chip2] ...\n", get_prog_name());

I prefer the first form myself.  It can be argued that the second form is
more confusing.  In both cases you need to parse the ellipsis, but the
second is close to:
    "Usage: %s [OPTIONS] <chip1> <chip2> ...\n"

which means something very different.

What does git do?

"git log [<options>] [<revision-range>] [[--] <path>...]"

"git branch (-d | -D) [-r] <branchname>..."

So it uses the first form for required parameters, and a variant of the
first form (i.e. "[<pattern>...]" where we use "[pattern]...") for
optional parameters.

Cheers,
Kent.

  reply	other threads:[~2023-07-04 12:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-04 12:12 [libgpiod][PATCH] tools: clarify the non-option arguments in help text Bartosz Golaszewski
2023-07-04 12:50 ` Kent Gibson [this message]
2023-07-04 14:45 ` Andy Shevchenko

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=ZKQVsPrhMEXwavIf@sol \
    --to=warthog618@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    /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