[PATCH 5/6] commands: drvinfo: support filtering by driver

Sascha Hauer sha at pengutronix.de
Thu Oct 27 01:49:41 PDT 2022


On Thu, Oct 27, 2022 at 09:51:38AM +0200, Ahmad Fatoum wrote:
> Hi!
> 
> On 27.10.22 09:29, Sascha Hauer wrote:
> > On Wed, Oct 26, 2022 at 08:42:04AM +0200, Ahmad Fatoum wrote:
> >> drvinfo can be very long especially for the in-tree defconfigs,
> >> add optional filtering support:
> >> +	if (IS_ENABLED(CONFIG_AUTO_COMPLETE) && argc > 1)
> >> +		filter = strjoin(" ", &argv[1], argc - 1);
> > 
> > Why does this depend on CONFIG_AUTO_COMPLETE?
> 
> drvinfo is something I think should always be enabled and I didn't want
> to bloat it unconditionally.
> 
> > 
> >> +
> >>  	printf("Driver\tDevice(s)\n");
> >>  	printf("--------------------\n");
> >>  	for_each_driver(drv) {
> >> +		if (filter && !str_has_prefix(drv->name, filter))
> >> +			continue;
> > 
> > I don't see how this is expected to work. When you pass multiple drivers
> > as argument 'filter' will be a concatenation of multiple driver names
> > which then matches nothing.
> 
> Autocomplete doesn't work for elements with spaces, so when you write
> 
>   drvinfo TI<Tab>
> 
> You get
> 
>     drvinfo TI DP83
> 
> with no further ability to complete. The prefix matching can work with that
> and will produce:

Then please fix the tab completion accordingly rather than further work
around this. See the series I just sent.

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