On 11/10/22 12:35, Thomas Huth wrote: > On 08/11/2022 10.43, Claudio Fontana wrote: >> On 11/8/22 09:59, Thomas Huth wrote: >>> On 08/11/2022 09.52, Claudio Fontana wrote: >>>> On 11/8/22 09:42, Thomas Huth wrote: >>>>> On 07/11/2022 13.27, Claudio Fontana wrote: >>>>>> should -net and -netdev be adapted too? >>>>> >>>>> "-netdev help" already works just fine ... and "-net" should IMHO rather >>>>> be >>>>> removed than improved ;-) >>>>> >>>>> Thomas >>>>> >>>> >>>> I wonder if it could be done once for all, in net_init_clients, >>>> instead of repeating the is_help_option in net_init_netdev and >>>> net_param_nic >>>> (and that would take care of net_init_client too, so we'd get "net" for >>>> free).. >>> >>> I don't think that it makes too much sense to have one option for all - >>> since all three CLI options are slightly different anyway. E.g. "-net nic" >>> only exists for "-net", "hubport" cannot be used with "-net", "-nic" can >>> also be used to configure the NIC model, etc. >>> >>> Thomas >>> >> >> Hi Thomas, I would not suggest to merge everything together, >> >> I was considering whether it would make sense to just check the "type" id >> for is_help_option >> once, since all the options "net", "netdev", "nic" have a "type" >> implied_opt_name, >> >> and so it should be possible to make a list of structs that signify what to >> do for "net", "netdev", "nic", and >> loop on that and check for that help string once, >> >> and then split off the codepath into the "net", "netdev", "nic" - specific >> code as it is now, >> either manually or by storing the function that is now in the foreach as a >> function pointer in the struct, ie moving the is_help_option check one level >> up. >> >> However, it might not be worth it since it seems that for "nic" the nic >> models need to also be printed, so it might make things needlessly verbose. >> >> Not sure, have not tried to write the code for it. > > Sorry, I currently fail to see how that should really work out nicely, so > I'll continue with my current patch. But feel free to write some patches, > maybe it's clearer to me if I see the code. > > Thomas >
No worries, maybe it's just too complex and not worth it. Ciao, C