[PATCH v1 2/2] app/testpmd: sort commands by help string

Burakov, Anatoly anatoly.burakov at intel.com
Fri May 23 12:19:27 CEST 2025


On 5/22/2025 12:24 AM, Stephen Hemminger wrote:
> On Wed, 14 May 2025 14:02:12 +0100
> Anatoly Burakov <anatoly.burakov at intel.com> wrote:
> 
>> When using '?' to find commands, it occasionally is difficult to find the
>> needed commands because all commands are not in alphabetical order, but
>> rather can be ordered rather arbitrarily.
>>
>> To address this, use help string to order commands. This sacrifices some
>> amount of grouping (i.e. when tm commands go one after another), but may
>> improve discoverability (and most similar commands tend to have similar
>> help strings and will be located closer together anyway).
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
>> ---
> 
> Sorting is good, but why not pre-sort builtin_ctx and make it const?
> 

It's difficult and error-prone to sort these messages statically because 
there's no obvious to know where to insert the new value without reading 
lots of help strings from other commands. You could argue that we could 
sort by variable name but it feels like an unnecessary burden on the 
developer to maintain this sorting order when we can just automate it at 
runtime without giving up anything.

-- 
Thanks,
Anatoly


More information about the dev mailing list