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

Sascha Hauer sha at pengutronix.de
Wed Jun 14 07:21:37 PDT 2023


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 "

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