[PATCH] commands: help: ignore options after first regular argument
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Jun 14 07:27:05 PDT 2023
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 at 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 |
More information about the barebox
mailing list