We need to update the way we do and convert interface definitions to always set the correct 'type:' field because the completion scripts need to behave differently for different node types, f.e. "file" needs to do filename completion, "range" shows a range of values sorted numerically, "u32" (number) sorts numerically, "txt" sorts alphabetically, etc.
Right now the "type" isn't regarded as important and can't be set in the XML, so the build-command-templates script defaults to type "txt", which sorts wrongly for numeric values.
Also, I see no reference to "type" in the XML definitions docs: https://phabricator.vyos.net/w/development/xml/
This needs to be updated with all the allowed "type" values, and how they relates to other things (validators, shell completion,...)
When all nodes have the correct type set, the bash completion scripts can be improved with different completion help sorting logic depending on node type.
https://github.com/vyos/vyatta-cfg/blob/current/etc/bash_completion.d/vyatta-cfg#L511
This is where the bash completion script has some handling of item types, but it doesn't do much with it other than print different item text to the screen.
This could be leveraged to apply different sorts to the help item list (right now it's always alphabetic).
https://github.com/vyos/vyatta-cfg/blob/current/src/cstore/cstore.cpp#L800
This is where the help items list is built for passing to the shell scripts. This needs to be studied and understood completely as it builds the help item pairs from the command definitions. We need to know the exact syntax for the old command definitions as they are still at the core of the system.