Re: [PATCH] commands: help: ignore options after first regular argument

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
>> ---
>>  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 |





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux