From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <sha@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] commands: help: ignore options after first regular argument
Date: Wed, 14 Jun 2023 16:27:05 +0200 [thread overview]
Message-ID: <d2603a7b-d7ef-71ab-ed86-db07582a5c2d@pengutronix.de> (raw)
In-Reply-To: <20230614142137.GB18491@pengutronix.de>
On 14.06.23 16:21, Sascha Hauer wrote:
> On Wed, Jun 14, 2023 at 11:02:31AM +0200, Ahmad Fatoum wrote:
>> If some-command -n foo bar -v fails, it would be nice to be able to
>> just stick help in front of the command to get help text. This doesn't
>> work currently, because getopt called for help will complain about not
>> knowing some-command's options. Fix this by only parsing help options up
>> to the first non-option argument (i.e. one that doesn't start with `-').
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>> commands/help.c | 19 ++++++++++++-------
>> 1 file changed, 12 insertions(+), 7 deletions(-)
>
> Just prefix with "help -- " instead of "help "
Oh. That works too... One could argue that most people are
interested in the help text for a single command, so not
having to type -- is a tiny bit better user experience.
>
> Sascha
>
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
prev parent reply other threads:[~2023-06-14 14:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 9:02 Ahmad Fatoum
2023-06-14 14:21 ` Sascha Hauer
2023-06-14 14:27 ` Ahmad Fatoum [this message]
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=d2603a7b-d7ef-71ab-ed86-db07582a5c2d@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=sha@pengutronix.de \
/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